Data compression using spatial decorrelation

ABSTRACT

Methods and modules for spatial decorrelation and recorrelation are described. A block of data values can be spatially decorrelated in two dimensions efficiently by processing rows of the data values in a particular order such that if the results of spatially decorrelating a first row will be used for column-wise spatial decorrelation of a second row then the data values of the first row are processed in an earlier iteration to that in which the data values of the second row are processed. This allows for highly parallelised processing of the block of data values. Spatial recorrelation can be performed as an inverse process to the spatial decorrelation.

BACKGROUND

Data compression, both lossless and lossy, is desirable in manyapplications in which data is to be stored in, and/or read from, amemory. By compressing data before storage of the data in a memory, theamount of data transferred to the memory may be reduced. An example ofdata for which data compression is particularly useful is image data,such as depth data to be stored in a depth buffer, pixel data to bestored in a frame buffer and texture data to be stored in a texturebuffer. These buffers may be any suitable type of memory, such as cachememory, separate memory subsystems, memory areas in a shared memorysystem or some combination thereof.

A Graphics Processing Unit (GPU) may be used to process image data inorder to determine pixel values of an image to be stored in a framebuffer for output to a display. GPUs usually have highly parallelisedstructures for processing large blocks of data in parallel. There issignificant commercial pressure to make GPUs (especially those intendedto be implemented on mobile devices) operate at lower power levels.Competing against this is the desire to use higher quality renderingalgorithms on faster GPUs, which thereby puts pressure on a relativelylimited resource: memory bandwidth. However, increasing the bandwidth ofthe memory subsystem might not be an attractive solution because movingdata to and from, and even within, the GPU consumes a significantportion of the power budget of the GPU. The same issues may be relevantfor central processing units (CPUs) as well as GPUs.

As described above, one way to reduce the amount of data transferred tothe memory is to compress the data that is to be transferred to and fromthe memory. The time taken for data to be compressed and decompressedadds to the latency of the memory read and write operations andtherefore may affect the speed at which the GPU operates. Furthermore,the rate at which data is compressed may be permitted to differ from therate at which that compressed data is decompressed. As an example, thecompression process for compressing texture data (which is typically alossy compression process) may often be permitted to be significantlyslower than the decompression process for decompressing the compressedtexture data. In contrast the compression processes for compressingdepth data for storage in a depth buffer or pixel data for storage in aframe buffer (which are typically lossless compression processes)ideally should be performed at approximately the same rate as thecorresponding decompression processes. GB2451911 discloses a graphicsrendering system which can compress a two-dimensional data set.

SUMMARY

This Summary is provided to introduce a selection of concepts in asimplified form that are further described below in the DetailedDescription. This Summary is not intended to identify key features oressential features of the claimed subject matter, nor is it intended tobe used to limit the scope of the claimed subject matter.

There is provided a method of performing spatial decorrelation on ablock of data values at a spatial decorrelation module as part of a datacompression process, the data values in the block being arranged into atwo dimensional array, wherein the spatial decorrelation modulecomprises a plurality of parallel processing pipelines each comprising afirst stage and a second stage, wherein the first stages of theprocessing pipelines are configured to implement first spatialdecorrelation in a first dimension, and wherein the second stages of theprocessing pipelines are configured to implement second spatialdecorrelation in a second dimension, the method comprising the steps, ineach of a plurality of iterations, of: receiving, at the first stage ofeach of the processing pipelines, one or more of the data values from afirst line of data values from the block; implementing first spatialdecorrelation in the first dimension on the received data values at thefirst stages of the processing pipelines to thereby output, from thefirst stage of each of the processing pipelines to corresponding secondstages of the processing pipelines, a first coefficient for a respectiveone of the data values of the first line; selectively storing the firstcoefficients for the first line in respective storage units of thesecond stages of the processing pipelines; and implementing secondspatial decorrelation in the second dimension on first coefficients atthe second stages of the processing pipelines for a second line forwhich the first spatial decorrelation was performed in a previousiteration, to thereby output, from the second stage of each of theprocessing pipelines, a second coefficient for a respective one of thedata values of the second line, wherein the second coefficients arespatially decorrelated data values, wherein said selectively storing thefirst coefficients comprises storing the first coefficients for thefirst line in the respective storage units if the first coefficients forthe first line will be used for the second spatial decorrelation foranother line of the block on a subsequent iteration, and wherein thelines of data values are received at the first stages of the processingpipelines in a particular order such that if the first coefficients fora particular line will be used for the second spatial decorrelation foranother line then the data values of the particular line are received atthe first stages in an earlier iteration to that in which the datavalues of the other line are received at the first stages. A computerreadable storage medium may be provided having encoded thereon computerreadable program code for generating a spatial decorrelation moduleconfigured to perform the spatial decorrelation method of any of theexamples described herein.

There is provided a spatial decorrelation module configured to performspatial decorrelation on a block of data values as part of a datacompression system, wherein the data values in the block are arrangedinto a two dimensional array, and wherein the spatial decorrelationmodule comprises a plurality of parallel processing pipelines eachcomprising a first stage and a second stage, wherein the first stages ofthe processing pipelines are configured to implement first spatialdecorrelation in a first dimension, and wherein the second stages of theprocessing pipelines comprise respective storage units and areconfigured to implement spatial decorrelation in a second dimension,wherein the first stage of each of the processing pipelines isconfigured to, in each of a plurality of iterations: (a) receive one ormore of the data values from a first line of data values from the block;and (b) implement first spatial decorrelation in the first dimension onthe received data values to thereby output, to corresponding secondstages of the processing pipelines, a first coefficient for a respectiveone of the data values of the first line; and wherein the second stageof each of the processing pipelines is configured to, in each of saidplurality of iterations: (a) selectively store the first coefficientsfor the first line in the respective storage units; and (b) implementsecond spatial decorrelation in the second dimension on firstcoefficients for a second line for which the first spatial decorrelationwas performed in a previous iteration, to thereby output a secondcoefficient for a respective one of the data values of the second line,wherein the second coefficients are spatially decorrelated data values,wherein the second stages of the processing pipelines are configured toselectively store the first coefficients for the first line in therespective storage units if the first coefficients for the first linewill be used for the second spatial decorrelation for another line ofthe block on a subsequent iteration, and wherein the first stages of theprocessing pipelines are configured to receive the lines of data valuesin a particular order such that if the first coefficients for aparticular line will be used for the second spatial decorrelation foranother line then the data values of the particular line are received atthe first stages in an earlier iteration to that in which the datavalues of the other line are received at the first stages. A datacompression unit may be provided comprising a spatial decorrelationmodule according to any of the examples described herein.

There is provided a method of performing spatial recorrelation on ablock of spatially decorrelated data values at a spatial recorrelationmodule as part of a data decompression process, the spatiallydecorrelated data values in the block being arranged into a twodimensional array, wherein the spatial recorrelation module comprises aplurality of parallel processing pipelines each comprising a first stageand a second stage, wherein the first stages of the processing pipelinesare configured to implement first spatial recorrelation in a firstdimension, and wherein the second stages of the processing pipelines areconfigured to implement second spatial recorrelation in a seconddimension, the method comprising the steps, in each of a plurality ofiterations, of: receiving, at the first stage of each of the processingpipelines, a respective one of the spatially decorrelated data valuesfrom a first line of spatially decorrelated data values of the block;implementing first spatial recorrelation in the first dimension on thereceived spatially decorrelated data values at the first stages of theprocessing pipelines to thereby output, from the first stage of each ofthe processing pipelines, a first coefficient for a respective one ofthe spatially decorrelated data values of the first line; selectivelystoring the first coefficients for the first line in respective storageunits of the first stages of the processing pipelines; and implementingsecond spatial recorrelation in the second dimension on firstcoefficients at the second stages of the processing pipelines for asecond line for which the first spatial recorrelation was performed in aprevious iteration, to thereby output, from the second stage of each ofthe processing pipelines, a second coefficient for a respective one ofthe spatially decorrelated data values of the second line, wherein thesecond coefficients are spatially recorrelated data values, wherein saidselectively storing the first coefficients comprises storing the firstcoefficients for the first line in the respective storage units if thefirst coefficients for the first line will be used for the first spatialrecorrelation for another line of the block on a subsequent iteration,and wherein the lines of spatially decorrelated data values are receivedat the first stages of the processing pipelines in a particular ordersuch that if the first coefficients for a particular line will be usedfor the first spatial recorrelation for another line then the spatiallydecorrelated data values of the particular line are received at thefirst stages in an earlier iteration to that in which the spatiallydecorrelated data values of the other line are received at the firststages. A computer readable storage medium may be provided havingencoded thereon computer readable program code for generating a spatialrecorrelation module configured to perform the spatial recorrelationmethod of any of the examples described herein.

There is provided a spatial recorrelation module configured to performspatial recorrelation on a block of spatially decorrelated data valuesas part of a data decompression system, wherein the spatiallydecorrelated data values in the block are arranged into a twodimensional array, and wherein the spatial recorrelation modulecomprises a plurality of parallel processing pipelines each comprising afirst stage and a second stage, wherein the first stages of theprocessing pipelines comprise respective storage units and areconfigured to implement first spatial recorrelation in a firstdimension, and wherein the second stages of the processing pipelines areconfigured to implement spatial recorrelation in a second dimension,wherein the first stage of each of the processing pipelines isconfigured to, in each of a plurality of iterations: (a) receive arespective one of the spatially decorrelated data values from a firstline of spatially decorrelated data values of the block; (b) implementfirst spatial recorrelation in the first dimension on the receivedspatially decorrelated data values to thereby output, to correspondingsecond stages of the processing pipelines, a first coefficient for arespective one of the spatially decorrelated data values of the firstline; and (c) selectively store the first coefficients for the firstline in the respective storage units; wherein the second stage of eachof the processing pipelines is configured to, in each of said pluralityof iterations: implement second spatial recorrelation in the seconddimension on first coefficients for a second line for which the firstspatial recorrelation was performed in a previous iteration, to therebyoutput a second coefficient for a respective one of the spatiallydecorrelated data values of the second line, wherein the secondcoefficients are spatially recorrelated data values, wherein the firststages of the processing pipelines are configured to selectively storethe first coefficients for the first line in the respective storageunits if the first coefficients for the first line will be used for thefirst spatial recorrelation for another line of the block on asubsequent iteration, and wherein the first stages of the processingpipelines are configured to receive the lines of spatially decorrelateddata values in a particular order such that if the first coefficientsfor a particular line will be used for the first spatial recorrelationfor another line then the spatially decorrelated data values of theparticular line are received at the first stages in an earlier iterationto that in which the spatially decorrelated data values of the otherline are received at the first stages. A data decompression unit may beprovided comprising a spatial recorrelation module according to any ofthe examples described herein.

The above features may be combined as appropriate, as would be apparentto a skilled person, and may be combined with any of the aspects of theexamples described herein.

BRIEF DESCRIPTION OF THE DRAWINGS

Examples will now be described in detail with reference to theaccompanying drawings in which:

FIG. 1 shows a graphics rendering system;

FIG. 2 shows a data compression unit;

FIG. 3 shows a flow chart for a method of compressing data;

FIG. 4 shows a data decompression unit;

FIG. 5 shows a flow chart for a method of decompressing data;

FIG. 6 shows a spatial decorrelation module;

FIG. 7 shows an illustration of a Linear prediction method;

FIG. 8 illustrates the operation of a processing pipeline of the spatialdecorrelation module;

FIG. 9 shows a flow chart for a method of performing spatialdecorrelation on a block of data values;

FIG. 10 is a table illustrating how an entropy coding scheme encodesdifferent symbol values;

FIG. 11 shows an entropy encoding module;

FIG. 12 shows a flow chart for a method of performing entropy encodingon a plurality of data values;

FIG. 13 shows an entropy decoding module;

FIG. 14 shows a flow chart for a method of performing entropy decodingon a plurality of entropy encoded data values;

FIG. 15 represents a first data packet comprising blocks of encoded datavalues;

FIG. 16 represents a second data packet comprising a plurality of datablocks;

FIG. 17 illustrates how the data of a channel is stored in the block ofencoded data values;

FIG. 18 shows a spatial recorrelation module; and

FIG. 19 illustrates the operation of a stage of a processing pipeline ofthe spatial recorrelation module.

Common reference numerals are used throughout the figures, whereappropriate, to indicate similar features.

DETAILED DESCRIPTION

Embodiments will now be described by way of example only.

Data compression is useful in a variety of different scenarios. Most ofthe examples described herein relate to the compression (anddecompression) of image data for use by a GPU, but similar principlescould be applied to the compression (and decompression) of other typesof data such as audio, numeric or text data and/or for use by aprocessing unit other than a GPU, such as a CPU.

FIG. 1 shows a graphics rendering system 100 which may be implemented inan electronic device, such as a mobile device. The graphics renderingsystem 100 comprises a host CPU 102, a GPU 104, a memory 106 (e.g. agraphics memory) and a display 108. The CPU 102 is arranged tocommunicate with the GPU 104. Data, which may be compressed data, can betransferred, in either direction, between the GPU 104 and the memory106. Images which are rendered by the GPU 104 may be displayed on thedisplay 108.

The GPU 104 comprises a rendering unit 110, a compression/decompressionunit 112, a memory interface 114 and a display interface 116. The system100 is arranged such that data can pass, in either direction, between:(i) the CPU 102 and the rendering unit 110; (ii) the CPU 102 and thememory interface 114; (iii) the rendering unit 110 and the memoryinterface 114; (iv) the memory interface 114 and the memory 106; (v) therendering unit 110 and the compression/decompression unit 112; (vi) thecompression/decompression unit 112 and the memory interface 114; and(vii) the memory interface 114 and the display interface. The system 100is further arranged such that data can pass from thecompression/decompression unit 112 to the display interface 116, andsuch that data can pass from the display interface to the display 108.

In operation, the GPU 104 processes regions of image data individually.The regions may for example represent rectangular (including square)portions of the image. The rendering unit 110 may perform scanconversion of graphics primitives, such as triangles and lines, usingknown techniques such as Z-tests and texture mapping. The rendering unit110 may contain cache units to reduce memory traffic. Some data is reador written by the rendering unit 110, to the memory 106 via the memoryinterface unit 114 (which may include a cache) but for other data, suchas data to be stored in a frame buffer, the data preferably goes fromthe rendering unit 110 to the memory interface 114 via thecompression/decompression unit 112. The compression/decompression unit112 reduces the amount of data that is to be transferred across theexternal memory bus to the memory 106 by compressing the data, asdescribed in more detail below.

The display interface 116 sends completed image data to the display 108.An uncompressed image may be accessed directly from the memory interfaceunit 114. Compressed data may be accessed via thecompression/decompression unit 112 and sent as uncompressed data to thedisplay 108. In alternative examples the compressed data could be sentdirectly to the display 108 and the display 108 could include logic fordecompressing the compressed data in an equivalent manner to thedecompression of the compression/decompression unit 112.

Although shown as a single entity, the compression/decompression unit112 may contain multiple parallel compression and/or decompression unitsfor enhanced performance reasons.

As a general overview, a compression system may follow a basicalgorithmic outline, such that the following steps are performed (notnecessarily in the order given below):

1. Division into Blocks

The image data is logically divided into independent, non-overlapping,rectangular blocks in order to permit random access to the compresseddata. The size of the blocks is implementation dependent and the blocksmay, for example, be 8×8, 16×4, 32×2, 4×4 or 32×16 blocks of datavalues. Increasing the block size tends to improve the compression ratiothat is achieved. However, increasing block size also tends to incurgreater hardware costs and, furthermore, may have decreased efficiencywhen access patterns become less coherent. So there is a balance to bestruck when selecting the block size, which is implementation dependentand which may, for example, depend upon characteristics of the type ofdata that is to be compressed. The block size may be selectedindependently of the size of the regions processed by the GPU, howeverthere may be some benefit from selecting a block size such that it is aconvenient multiple of the region size, or vice versa.

2. Format Conversion

Some buffers, e.g. the depth buffer, may store data in floating-pointformat, but performing lossless arithmetic on floating-point numbers canbe problematic. Therefore, the floating-point values may be interpretedas signed magnitude integer values to permit lossless calculations.Format conversion may also be used where the data values comprise aplurality of channels representing data of different colour components,wherein the values in the channels are not multiples of 8 bits, e.g.RGB5:6:5 or ARGB2:10:10:10 formats. The format of the data values may beconverted so that each channel has values which are multiples of 8 bits(e.g. ARGB 8:8:8:8 format). The format conversion step is not alwaysneeded in the compression process, e.g. when the data is already in aninteger format, or some other format on which lossless arithmetic can beperformed.

3. Colour Channel Decorrelation

The data values may comprise a plurality of channels representing dataof different colour components. For example, the data may be in ARGB8:8:8:8 format, where there are 8-bits to represent each of the Alpha,Red, Green and Blue channels of each of the data values. There isfrequently considerable correlation between the values of some or all ofthe colour channels (e.g. the R, G and B channels), and a compressionalgorithm can take advantage of this correlation to compress the databy, on average, reducing the range of some of the channels. Suitablecolour space transforms for exploiting the correlation between thedifferent colour channels are known in the art, for example as describedin GB2451911, and are not described in detail herein. Suitable colourspace transforms are lossless and “non-expanding” meaning that thenumber of bits used to represent a colour value does not increase due tothe colour space transform.

4. Spatial Decorrelation

Spatial decorrelation (also referred to as ‘prediction’) removes some ofthe correlation between nearby pixels, thereby reducing, on average, thedynamic ranges of the values. A method for performing spatialdecorrelation is described below in detail with reference to FIGS. 6 to9.

5. Entropy Encoding

Entropy encoding makes use of the statistical properties of thedecorrelated data to reduce the number of bits used to represent thedata. Arithmetic coding schemes are relatively computationally intensiveand slow. Therefore, relatively simple Variable Length Coding (VLC)(e.g. Huffman or Golomb-Rice) or Run-Length based entropy encodingschemes have been used. However, it can be difficult to perform entropyencoding at high speeds even with the simple VLC encoding schemes. A newmethod for performing entropy encoding and decoding at high speed andwith low computational complexity is described below in detail withreference to FIGS. 10 to 14.

6. Storage

Finally, the compressed data is stored in the memory 106. The details ofthe mechanism for storing data in the memory 106 will be known to thoseskilled in the art, and as such are not described in great detailherein.

A decompression system may follow the reverse of the basic algorithmicoutline given above for compression (not necessarily in the reverse ofthe order given above).

The general compression algorithm given above may be applied in thecompression/decompression unit 112. FIG. 2 shows modules of thecompression/decompression unit 112 which are to be used to compress ablock of ARGB data values which comprise four 8-bit channels, when thecompression/decompression unit 112 is operating as a compression unit.In other examples the compression/decompression unit 112 may be used tocompress blocks of data values which have other formats. The compressionunit 112 comprises a colour decorrelation module 202, four spatialdecorrelation modules 204 ₁ to 204 ₄, four entropy encoding modules 206₁ to 206 ₄ and a packing module 208.

FIG. 3 shows a flow chart for a method of compressing a block of data.In step S302 a block of uncompressed data is received at the compressionunit 112. The first step of the general compression algorithm givenabove, i.e. the division into blocks, may be performed on the databefore it is received at the compression unit 112. Alternatively, thisstep may be performed at the compression unit 112. The uncompressed datais received at the colour decorrelation module 202. In step S304 thecolour decorrelation module 202 may apply the format conversion to thedata values as described above. It is noted that the format conversionstep might not be implemented, e.g. when the data is already in asuitable format (such as in an integer format), such that no formatconversion is necessary. In the example shown in FIGS. 2 and 3, the datareceived at the compression unit 112 is already divided into blocks,e.g. 8×8 blocks. Furthermore, in this example, the received data is inARGB 8:8:8:8 format, and no format conversion is needed in step S304.That is, in this example, each data value in the 8×8 block comprises 32bits: 8 bits for the Alpha channel, 8 bits for the Red channel, 8 bitsfor the Green channel and 8 bits for the Blue channel.

In step S304 the colour decorrelation module 202 also applies colourdecorrelation to the data values. Suitable colour decorrelation methodsare known in the art. Preferably, a colour decorrelation method is usedwhich does not expand any of the output channels, i.e. the number ofbits output from the colour correlation module 202 is not greater thanthe number of bits input to the colour decorrelation module 202.

In other examples, the data values of the Alpha channel are sent to thespatial decorrelation module 204 ₄, and the data values of the R, G andB channels are sent to the colour decorrelation module 202, such thatthe colour decorrelation module 202 applies the colour decorrelationonly to the R, G and B values.

It has been found (e.g. as shown in GB2451911) that the following,remarkably simple, colour transform performs well for 8-bit colourvalues:

R′=R−G mod 2⁸

G′=G

B′=B−G mod 2⁸

A′=A

where R, G, B and A are the data values of the channels received at thecolour decorrelation module 202 and R′, G′, B′ and A′ are the datavalues of the decorrelated colour channels output from the colourdecorrelation module 202.

The distribution of the transformed channels, R′ and B′, is notdissimilar to a (bounded) Laplace distribution function centred on zero.Performing the modulo operation in the transforms shown above reducesthe dynamic range of the distribution such that fewer bits can be usedthan if the values of R-G and B-G were used without performing themodulo operations. It is noted that the modulo operation given above ismod 2⁸ because each data value in the channels comprises 8 bits in theexample given above. In other examples, each data value may have adifferent number of bits, e.g. n bits, in which case the modulooperation would be changed accordingly, e.g. to be mod 2^(n).

The colour-decorrelated values of the Red, Green, Blue and Alphachannels are output from the colour decorrelation module 202 and splitfrom each other in order to be passed to the respective spatialdecorrelation modules 204 ₁, 204 ₂, 204 ₃ and 204 ₄. In step S306 thespatial decorrelation modules 204 each apply spatial decorrelation to ablock of data values of the respective colour channels to thereby removea significant portion of the correlation between pixels in the block.The selection of a spatial decorrelation method should consider atrade-off between relevant factors, such as the reduction in spatialcorrelation that can be achieved, the complexity and/or the latency ofthe operations involved in the spatial decorrelation and the complexityand/or the latency of the operations involved in recorrelating thespatially decorrelated values. An example of the spatial decorrelationapplied by each of the spatial decorrelation modules 204 is described inmore detail below with reference to FIGS. 6 to 9.

The spatially decorrelated data values are output from each of thespatial decorrelation modules 204 ₁ to 204 ₄ and are provided to thecorresponding entropy encoding modules 206 ₁ to 206 ₄. In step S308 theentropy encoding modules 206 apply entropy encoding to the data values.The entropy encoding is performed according to a variable-length coding(VLC) scheme, such that the entropy encoded values will most likely notall have the same number of bits. In general, more probable values areencoded with fewer bits. In this way, it is likely that the total numberof bits used to encode all of the data values in a data block will bereduced by the entropy encoding. This is generally true, even if theentropy encoding does result in a few data values being representedusing a greater number of bits following the entropy encoding, e.g. morethan eight bits in the examples where the spatially decorrelated datavalues are represented using eight bits. There are some situations wherespatial decorrelation can expand data, and these situations can betreated as special cases (i.e. the data is treated differently to othercases) in order to limit the expansion.

VLC encoding can be reasonably straightforward to perform at a highrate, but VLC decoding at a matching rate can be significantly moredifficult because the bit-boundaries between contiguously stored encodeddata values are not known until the encoded data is analysed, i.e. thelength of the encoded data values is not known until the encoded data isanalysed. In particular, when encoding, multiple symbols can be mappedindependently to their corresponding codes and code lengths, and thenmerged into a contiguous output bit stream. However, typically whendecoding, each code in the encoded bit stream must be examinedsequentially in order to determine its length which, in turn, determinesthe location of the start of the next code. In other words, thebit-boundaries between the different encoded data values need to befound. While it is possible to embed pointers (i.e. offsets) at the headof the stream to assist in decoding several symbols in parallel (e.g. toidentify the bit-boundaries in the stream), doing so compromises thecompression rate since additional bits are used for thepointers/offsets. An example of the entropy encoding applied by each ofthe entropy encoding modules 206 is described in more detail below withreference to FIGS. 10 to 12.

The entropy encoded data values are output from each of the entropyencoding modules 206 and are provided to the packing module 208. In stepS310 the packing module packs the encoded data values from the differentchannels together into a compressed data block in accordance with apacking scheme. In step S312 the packed data values are output from thepacking module 208 as compressed data. The compressed data may be sentto the memory 106 (e.g. via the memory interface 114) for storagetherein.

The steps shown in FIG. 3 are iterated for different data values. Aplurality of data values (e.g. a row of data values from a block ofuncompressed data values) may be processed on each iteration. Theiterations may be performed on respective consecutive clock cycles.Therefore, as an example, where there are eight data values in a row ofthe block, eight data values may be compressed per clock cycle.

FIG. 4 shows modules of the compression/decompression unit 112 which areto be used to decompress a block of ARGB data values, when thecompression/decompression unit 112 is operating as a decompression unit.The decompression unit 112 comprises a colour recorrelation module 402,four spatial recorrelation modules 404 ₁ to 404 ₄, four entropy decodingmodules 406 ₁ to 406 ₄ and an unpacking module 408.

FIG. 5 shows a flow chart for a method of decompressing a block of data.In step S502 compressed data is received at the unpacking module 408 ofthe decompression unit 112 from the memory 108 (e.g. via the memoryinterface 114). The compressed data has been compressed using the methoddescribed above in relation to FIGS. 2 and 3. In step S504 thecompressed data values are unpacked into different channels for thedifferent colour components (e.g. Red, Green, Blue and Alpha channels).The compressed data is unpacked in accordance with an unpacking schemewhich corresponds to the packing scheme used to pack the data valuesinto a compressed data block in step S310. The encoded data values (i.e.the compressed data) for the different channels are provided torespective ones of the entropy decoding modules 406.

In step S506 each of the entropy decoding modules 406 apply entropydecoding to the encoded data values. The entropy decoding is performedin accordance with the variable-length coding (VLC) scheme that was usedin step S308 to encode the data values. An example of the entropydecoding applied by each of the entropy decoding modules 406 isdescribed in more detail below with reference to FIGS. 13 and 14.

The entropy decoded data values are output from the entropy decodingmodules 406 ₁ to 406 ₄ and are provided to the corresponding spatialrecorrelation modules 404 ₁ to 404 ₄. In step S508 the spatialrecorrelation modules 404 each apply spatial recorrelation to theentropy decoded data values of the respective colour channels. In thisway the spatial decorrelation that was applied to the data values instep S306 is reversed.

The data values of the R, G, B and A channels are sent to the colourrecorrelation module 402. In step S510 the colour recorrelation module402 applies colour recorrelation to the data values of the R, G, B and Achannels. The colour recorrelation method is chosen to be the reverse ofthe colour decorrelation method used in step S304 described above. Insome other examples, the alpha channel might bypass the colourrecorrelation module 402, e.g. if it is not needed for the colourrecorrelation.

Following step S510 the data values for each of the channels (e.g. R, G,B and A channels) have been decompressed, and in step S512 these datavalues are output as the decompressed data. The decompressed data may beoutput to any other element in the device. The decompressed data may beused in any suitable manner, for example, if the data is image data, thedecompressed data may be output to the display interface 116 for outputto the display 108. In other examples, the data may be used as a sourcefor a video compositor or as a texture in a 3D render.

The steps shown in FIG. 5 are iterated for different data values. Aplurality of data values (e.g. a row of data values from a block ofdecompressed data values) may be processed on each iteration. Theiterations may be performed on respective consecutive clock cycles.Therefore, as an example, where there are eight data values in a row ofthe block, eight data values may be decompressed per clock cycle. Whenthere are multiple channels of data, those channels may be decompressedindependently. For example, an ARGB system might decompress 32 (i.e.4×8) data values per clock cycle.

It can be useful to allow a predictable number of data values to becompressed and/or decompressed in each clock cycle. This is notnecessarily trivial when variable-length entropy coding is used and/orwhen 2D spatial decorrelation is to be performed. Furthermore, theability to compress and decompress multiple data values (e.g. eight datavalues) on each clock cycle allows the compression and decompression ofblocks of data to be performed quickly, i.e. with reduced latency,compared to other compression or decompression methods which cannotcompress and/or decompress as many data values in each clock cycle.

Examples showing how the spatial decorrelation and the entropyencoding/decoding modules can achieve the compression/decompressionrates mentioned above are described below.

FIG. 6 shows one of the spatial decorrelation modules 204 which may beimplemented in any one of the colour channels. In the example shown inFIG. 6, an 8×8 block of data values 602 for the channel is received atthe spatial decorrelation module 204. The data values in the data block602 are arranged into a two dimensional array of eight rows (labelled 0to 7 in FIG. 6) and eight columns (labelled A to H in FIG. 6). Each ofthe data values comprises 8 bits in the example shown in FIG. 6 suchthat each row of the data block comprises 64 bits. The spatialdecorrelation module 204 is configured to process the rows of the datablock on respective consecutive clock cycles to thereby perform spatialdecorrelation in two dimensions on the data values from the block. FIG.9 shows a flow chart for a process of performing two dimensional (2D)spatial decorrelation on the block of data values 602 at the spatialdecorrelation module 204.

The spatial decorrelation module 204 comprises a plurality of parallelprocessing pipelines (604 ₁ to 604 ₈) each comprising a first stage 606and a second stage 608. The first stages 606 of the processing pipelines604 are configured to implement spatial decorrelation along rows of datavalues. The first stages 606 of all of the processing pipelines 604except for the last processing pipeline 604 ₈ comprise a processing unit610 which is configured to determine a first coefficient to represent arespective one of the data values from a row that is being processed.The second stages 608 of the processing pipelines 604 are configured toimplement spatial decorrelation along columns of data values. The secondstage 608 of each of the processing pipelines 604 comprises a storageunit (e.g. a register 612) and a processing unit 614. In the exampleshown in FIG. 6, the registers 612 have sufficient capacity to store atleast three of the data values, which for example each have eight bits.It is noted that in FIG. 6 the processing unit 610 ₁, the register 612 ₁and the processing unit 614 ₁ are labelled for the first processingpipeline 604 ₁, but for clarity the corresponding processing units 610_(n), registers 612 _(n) and processing units 614 _(n) are not labelledin FIG. 6 for the other processing pipelines 604 _(n) (where 2≦n≦8).

In operation, in step S902 the data values from a row (e.g. row 0) ofthe data block 602 are received. In particular, each of the processingpipelines 604 is configured to receive one or more of the data valuesfrom a particular row of the data block. In the example shown in FIG. 6the processing units 610 of the first stages of the processing pipelines604 ₁ to 604 ₇ receive more than one of the data values from aparticular row of the data block 602, but the first stage of theprocessing pipeline 604 ₈ receives just one of the data values from aparticular row of the data block 602. In step S904, each of the firststages 606 determine a first coefficient which represents a respectiveone of the data values of the particular row. The first coefficients aredetermined by the processing units 610 of the processing pipelines 604 ₁to 604 ₇ based on the data values received at the processing units 610in step S902, and according to any suitable prediction scheme, such as ascheme based on Linear prediction or based on Haar prediction. The firststage 606 of the last processing pipeline 604 ₈ simply determines thefirst coefficient to be the same as the data value received thereat.

In each of the first stages of the processing pipelines 604 ₁ to 604 ₇,in order to determine a first coefficient to represent a data value, aprediction of the data value is determined using other data values, andthen the first coefficient is based on the difference between thereceived data value and the prediction of the data value. Provided theprediction is sufficiently accurate, the value of the first coefficient(e.g. the difference between the actual data value and the predictionvalue) is generally significantly less than actual data value itself,and can therefore be represented using fewer bits. The firstcoefficients may often be equal to, or nearly equal, to zero.

The Linear or Haar prediction schemes may include a two stage process:prediction and then update, i.e. prediction and error compensation. TheLinear and Haar prediction schemes are based on 2^(nd) generationwavelets. That is, for every data value at an odd numbered position in arow or column (which may be referred to as an “odd data value”) apredicted value is determined based on some set of one or more datavalues at even positions (which may be referred to as “even datavalues”). In the Haar prediction scheme the determination is based onone even data value, and in the Linear prediction scheme thedetermination is based on two even data values. The odd data values arereplaced with differences between the actual data values and thepredicted values. Then the prediction is repeated on a different scaleto predict other data values. The primary aim of the update step is topreserve image moments. Maintaining such statistical properties isuseful when coefficients are quantised as part of a lossy compressionprocess but, for lossless data compression as in examples describedherein, the update steps are not included. Avoiding the update steps: a)has no significant detrimental effect on the average compression ratio,b) halves the number of hardware operations in the prediction processes,and c) greatly shortens the calculation dependency chain for bothencoding and decoding.

The Linear and/or Haar prediction schemes may be applied at differentspatial frequencies to thereby predict different ones of the datavalues. At each frequency a set of the data values is used to replaceodd data values with differences between actual and predicted datavalues. When taking the highest frequency, all of the data values fromthe data block are in the set of data values that are used. The odd datavalues in the set, P_(2i+1), (where i is an integer) are predicted fromone or more neighbouring data values from the set with even indices e.g.P_(2i) and/or P_(2i+2), and P_(2i+1) is replaced with the differencebetween the actual and predicted value for P_(2i+1). At a lowerfrequency, the set includes fewer (e.g. half) of the data values fromthe data block. The process can be repeated at lower frequencies untilall but one of the data values in a row are predicted from one or moreother data values in that row. For example, with reference to FIG. 6,data values in column B are predicted from data values in columns A andC; data values in column C are predicted from data values in columns Aand E; and data values in column E are predicted from data values incolumn A. The prediction and replacement operations, which are used todetermine the first coefficients, P′_(2i+1), for the odd data values,P_(2i+1), using the Linear and Haar prediction schemes are given by:

P′ _(2i+1) =P _(2i+1) −LPredict(P _(2i) ,P _(2i+2))mod 2⁸ (Linear)

P′ _(2i+1) =P _(2i+1) −P _(2i) mod 2⁸ (Haar)

where the function LPredict is given by:

${{LPredict}\left( {A,B} \right)} = \left\{ \begin{matrix}{{\left( {\left\lfloor \frac{A + B}{2} \right\rfloor + 2^{7}} \right){mod}\; 2^{8}},} & {{{if}\mspace{14mu} {{A - B}}} \geq 2^{7}} \\{{\left\lfloor \frac{A + B}{2} \right\rfloor {mod}\; 2^{8}},} & {otherwise}\end{matrix} \right.$

The purpose of the LPredict function is to generate the most probableaverage of two input values that have been calculated modulo 2⁸.Referring to FIG. 7, if one considers a clock face with 256 (i.e. 2⁸)‘minutes’, then there are two paths one can take to traverse from anytwo positions on the clock. Because, in the example shown in FIG. 7,calculations are performed mod 2⁸, any 8-bit value represents all valuesof the larger, but finite, congruent set, but given that the expectedprobability distribution function is heavily biased towards zero, valueswith smaller magnitudes are far more likely to be the actual value. Asan example, FIG. 7 shows an illustration of how the LPredict functioncan predict a value for the data value P_(2i+1) when|P_(2i)−P_(2i+2)|≧2⁷. In the example shown in FIG. 7, P_(2i)=220 andP_(2i+2)=20. If a simple average is taken of these two values, bydetermining

${\left\lfloor \frac{P_{2\; i} + P_{{2\; i} + 2}}{2} \right\rfloor {mod}\; 2^{8}},$

then the result will be 120. However, according to the equations givenabove, since |P_(2i)−P_(2i+2)|≧2⁷, then the result of the LPredictfunction is given by

${{\left( {\left\lfloor \frac{P_{2\; i} + P_{{2\; i} + 2}}{2} \right\rfloor + 2^{7}} \right){mod}\; 2^{8}} = {{\left( {120 + 128} \right){mod}\; 2^{8}} = 248}},$

as shown in FIG. 7. Due to the modulo operation, 248 is congruent to avalue of −8. A value of −8 is much more likely than a value of 120, andas such −8 (which is congruent to 248) is determined as the result ofthe LPredict function.

The ‘branch’ in the LPredict function is trivial to implement inhardware, since the ‘comparison’ is an XOR of the two Most SignificantBits (MSBs) of the two data values P_(2i) and P_(2i+2). Furthermore, theapplied offset (of 2⁷) is again, implemented as a one-bit XOR operation.

Spatial decorrelation is applied to the different colour channelsindependently by the respective spatial decorrelation modules 204. In anexample, each of the spatial decorrelation modules 204 operate as shownin FIG. 6 with a throughput of one 8×8 block of data values in 8 clockcycles, stepping to a different row of the block each on each clockcycle. Each of the processing units (610 and 614) shown in FIG. 6 canperform either a linear or, by repetition of the inputs, a Haarprediction per clock cycle. In other examples, the processing unitswhich only perform Haar predictions (e.g. processing units 610 ₄, 610 ₆and 610 ₇), might only receive two inputs, to avoid repeating inputs. Iftwo adjacent neighbouring data values at a particular frequency areavailable then the Linear prediction is applied, whereas if only oneadjacent neighbouring data value is available at a particular frequencythen the Haar prediction is applied. On each clock cycle a row isdecorrelated at three frequencies using linear prediction for columns B,D, F, and C, and Haar prediction for columns H, G and E. For 8×8 blocks,column A is unmodified by the horizontal prediction performed by theprocessing units 610.

The equations given above for the Linear and Haar prediction schemesrelate to the case in which the data values comprise 8 bits. It would beimmediately apparent to a person skilled in the art how to modify theseequations for data values having a different number of bits. Forexample, for n-bit data values, occurrences of 2⁸ in the equations abovewould be replaced with 2^(n) and occurrences of 2⁷ would be replaced by2^(n−1).

The first coefficients determined by the first stages 606 of theprocessing pipelines 604 are output from the first stages to thecorresponding second stages 608 of the processing pipelines 604.

In particular, in the example shown in FIG. 6, the first stage 606 ofthe first processing pipeline 604 ₁ receives data values of a particularrow from column positions A, B and C and outputs a first coefficient torepresent the data value of the particular row from column position B;the first stage 606 of the second processing pipeline 604 ₂ receivesdata values of the particular row from column positions C, D and E andoutputs a first coefficient to represent the data value of theparticular row from column position D; the first stage 606 of the thirdprocessing pipeline 604 ₃ receives data values of the particular rowfrom column positions E, F and G and outputs a first coefficient torepresent the data value of the particular row from column position F;the first stage 606 of the fourth processing pipeline 604 ₄ receivesdata values of the particular row from column positions G and H andoutputs a first coefficient to represent the data value of theparticular row from column position H; the first stage 606 of the fifthprocessing pipeline 604 ₅ receives data values of the particular rowfrom column positions A, C and E and outputs a first coefficient torepresent the data value of the particular row from column position C;the first stage 606 of the sixth processing pipeline 604 ₆ receives datavalues of the particular row from column positions E and G and outputs afirst coefficient to represent the data value of the particular row fromcolumn position G; the first stage 606 of the seventh processingpipeline 604 ₇ receives data values of the particular row from columnpositions A and E and outputs a first coefficient to represent the datavalue of the particular row from column position E; and the first stage606 of the eighth processing pipeline 604 ₈ receives data values of theparticular row from column position A and outputs a first coefficient torepresent the data value of the particular row from column position A.

It is noted that the last processing pipeline 604 ₈ does not need aprocessing unit in the example shown in FIG. 6 in which an 8×8 block ofdata values is processed because in this case the data values for columnA pass through the first stage 606 of the processing pipeline 604 ₈unchanged.

In step S906 the first coefficients outputted from the first stages 606are received at the corresponding second stages 608 of the processingpipelines 604. In particular, the first coefficients are received at theregisters 612 of the second stages 608 of the processing pipelines 604.

The first coefficients are then spatially decorrelated vertically. Therows of the data block are input to the parallel processing pipelines604 in an order such that after a first one of the rows has beenreceived by the second stages 608 and stored in the registers 612, thesecond coefficients of each subsequent row of the block that is receivedat the second stages 608 can be determined based on the stored datavalues in the registers 612. For example, as described in more detailbelow, the rows may be supplied to the processing pipelines 604 in theorder: row 0, row 4, row 6, row 7, row 5, row 2, row 3 and then row 1.The transpose of the horizontal decorrelation described above is thenapplied in the y-direction (i.e. in a vertical direction along thecolumns), at the target rate, with only minimal additional storage. Inparticular, as in the example shown in FIGS. 6 and 8 (described below),the registers 612 may not need to store more than three of the datavalues at any one time.

One slight variation in the processing can be made if the input pixelsare known to be adjacent samples in a multisample anti-aliasing (MSAA)scheme. For MSAA there is a high probability that neighbouring datavalues will be identical. In this situation, Haar prediction may be usedfor an appropriate number of initial frequencies because Haar predictionis based on the difference between two adjacent data values, which inthis case is likely to be zero, and may therefore result in lower datavalues (which can be represented with fewer bits) than if a Linearprediction is used.

In step S910 the first coefficients received from the correspondingfirst stages 606 are selectively stored in the registers 612 of each ofthe second stages 608 of the processing pipelines 604. That is, for someof the rows, the first coefficients are stored in the registers 612,whereas for others of the rows, the first coefficients are not stored inthe registers 612. In particular, the first coefficients are stored inthe registers 612 if those first coefficients are to be used todetermine the second coefficients for subsequent rows.

For each of the processing pipelines 604, the register 612 is configuredto output up to two values at a time (e.g. per clock cycle) to therespective processing unit 614. On each iteration, the firstcoefficients received from the first stage 606 of the correspondingprocessing pipeline 604 are passed to the respective processing unit 614and the registers 612 are configured to output zero, one or two of thefirst coefficients stored in the registers 612 to the respectiveprocessing unit 614. In step S912, each of the processing units 614determines a second coefficient to represent a respective one of thedata values from the row being processed. The second coefficients arespatially decorrelated values representing the data values of the blockand are output from the spatial decorrelation module 204. For the firstrow of data values of a block, the second coefficients are determinedbased solely on the first coefficients received for the data values ofthat row. The first coefficients for the data values of the first roware stored in the registers 612 such that, for a subsequent row of datavalues from the block, the second coefficients are determined based onthe stored first coefficients and the first coefficients for thesubsequent row. For example, for all of the rows of data values exceptthe first row of a block, the second coefficients for a row of datavalues are determined based on: (i) the corresponding first coefficientsfor the row received at the second stages 608, and (ii) at least one ofthe first coefficients for a respective at least one other row stored inthe respective registers 612.

FIG. 8 shows an example of the order in which data values from differentrows of an 8×8 block are input into the processing pipelines 604. Theoperation of the second stages 608 of the processing pipelines 604 issummarised in the table shown in FIG. 8. It can be seen that theprocessing unit 614 has three inputs labelled “Left”, “Centre” and“Right” in FIG. 8, whereby the centre input is coupled to the output ofthe processing unit 610, whereas the left and right inputs are coupledto outputs of the registers 612. On a first clock cycle (clock cycleC0), the second stages 608 of the pipelines 604 receive the firstcoefficients for row 0 (the value input to the second stage 608 isindicated by a single prime: 0′) and output the second coefficients forrow 0 (the value output from the second stage 608 is indicated by adouble prime: 0″), wherein the storage units store the firstcoefficients for row 0 (i.e. following clock cycle C0, the registers 612store the first coefficients for row 0, denoted 0′).

On a second clock cycle (clock cycle C1), the second stages 608 of thepipelines 604 receive the first coefficients for row 4 (the value inputto the second stage 608 is 4′) and output the second coefficients forrow 4 (the value output from the second stage 608 is 4″). That is, theprocessing unit 614 receives 4′ on the centre input and receives 0′ onthe left and right inputs, such that the second coefficients for row 4(denoted 4″) are determined by the processing units 614 based on thereceived first coefficients for row 4 (denoted 4′) and the stored firstcoefficients for row 0 (denoted 0′, retrieved from the registers 612).Following clock cycle C1 the storage units store the first coefficientsfor rows 0 and 4 (i.e. the registers 612 store the first coefficientsfor rows 0 and 4, denoted 0′ and 4′).

On a third clock cycle (clock cycle C2), the second stages 608 of thepipelines 604 receive the first coefficients for row 6 (the value inputto the second stage 608 is 6′) and output the second coefficients forrow 6 (the value output from the second stage 608 is 6″). That is, theprocessing unit 614 receives 6′ on the centre input and receives 4′ onthe left and right inputs, such that the second coefficients for row 6(denoted 6″) are determined by the processing units 614 based on thereceived first coefficients for row 6 (denoted 6′) and the stored firstcoefficients for row 4 (denoted 4′, retrieved from the registers 612).Following clock cycle C2 the storage units store the first coefficientsfor rows 0, 4 and 6 (i.e. the registers 612 store the first coefficientsfor rows 0, 4 and 6, denoted 0′, 4′ and 6′).

On a fourth clock cycle (clock cycle C3), the second stages 608 of thepipelines 604 receive the first coefficients for row 7 (the value inputto the second stage 608 is 7′) and output the second coefficients forrow 7 (the value output from the second stage 608 is 7″). That is, theprocessing unit 614 receives 7′ on the centre input and receives 6′ onthe left and right inputs, such that the second coefficients for row 7(denoted 7″) are determined by the processing units 614 based on thereceived first coefficients for row 7 (denoted 7′) and the stored firstcoefficients for row 6 (denoted 6′, retrieved from the registers 612).Following clock cycle C3 the storage units store the first coefficientsfor rows 0, 4 and 6 (i.e. the registers 612 store the first coefficientsfor rows 0, 4 and 6, denoted 0′, 4′ and 6′).

On a fifth clock cycle (clock cycle C4), the second stages 608 of thepipelines 604 receive the first coefficients for row 5 (the value inputto the second stage 608 is 5′) and output the second coefficients forrow 5 (the value output from the second stage 608 is 5″). That is, theprocessing unit 614 receives 5′ on the centre input, receives 4′ on theleft input and receives 6′ on the right input, such that the secondcoefficients for row 5 (denoted 5″) are determined by the processingunits 614 based on the received first coefficients for row 5 (denoted5′) and the stored first coefficients for rows 4 and 6 (denoted 4′ and6′, retrieved from the registers 612). Following clock cycle C4 thestorage units store the first coefficients for rows 0 and 4 (i.e., theregisters 612 store the first coefficients for rows 0 and 4, denoted 0′and 4′). The first coefficient for row 6 (denoted 6′) may be discardedbecause it is not needed for subsequent rows, but it may be simpler toleave 6′ in the registers 612 until it is overwritten.

On a sixth clock cycle (clock cycle C5), the second stages 608 of thepipelines 604 receive the first coefficients for row 2 (the value inputto the second stage 608 is 2′) and output the second coefficients forrow 2 (the value output from the second stage 608 is 2″). That is, theprocessing unit 614 receives 2′ on the centre input, receives 0′ on theleft input and receives 4′ on the right input, such that the secondcoefficients for row 2 (denoted 2″) are determined by the processingunits 614 based on the received first coefficients for row 2 (denoted2′) and the stored first coefficients for rows 0 and 4 (denoted 0′ and4′, retrieved from the registers 612). Following clock cycle C5 thestorage units store the first coefficients for rows 0, 4 and 2 (i.e. theregisters 612 store the first coefficients for rows 0, 4 and 2, denoted0′, 4′ and 2′).

On a seventh clock cycle (clock cycle C6), the second stages 608 of thepipelines 604 receive the first coefficients for row 3 (the value inputto the second stage 608 is 3′) and output the second coefficients forrow 3 (the value output from the second stage 608 is 3″). That is, theprocessing unit 614 receives 3′ on the centre input, receives 2′ on theleft input and receives 4′ on the right input, such that the secondcoefficients for row 3 (denoted 3″) are determined by the processingunits 614 based on the received first coefficients for row 3 (denoted3′) and the stored first coefficients for rows 2 and 4 (denoted 2′ and4′, retrieved from the registers 612). Following clock cycle C6 thestorage units store the first coefficients for rows 0 and 2 (i.e. theregisters 612 store the first coefficients for rows 0 and 2, denoted 0′and 2′). The first coefficient for row 4 (denoted 4′) may be discardedbecause it is not needed for subsequent rows, but it may be simpler toleave 4′ in the registers 612 until it is overwritten.

On an eighth clock cycle (clock cycle C7), the second stages 608 of thepipelines 604 receive the first coefficients for row 1 (the value inputto the second stage 608 is 1′) and output the second coefficients forrow 1 (the value output from the second stage 608 is 1″). That is, theprocessing unit 614 receives 1′ on the centre input, receives 0′ on theleft input and receives 2′ on the right input, such that the secondcoefficients for row 1 (denoted 1″) are determined by the processingunits 614 based on the received first coefficients for row 1 (denoted1′) and the stored first coefficients for rows 0 and 2 (denoted 0′ and2′, retrieved from the registers 612). It is not important what isstored in the registers 612 following clock cycle C7 because in thesubsequent clock cycle, the process repeats with a new block, so thedata in the registers 612 for the current block will not be used. Thedata may be overwritten by data for a new block when such data is to bestored in the registers 612.

In the example, shown in FIG. 8, the registers 612 each store up tothree of the first coefficients at any given time, in order to processthe data values from a block comprising eight rows of data values. Ingeneral, each of the registers 612 will have the capacity to store up tolog₂(r) first coefficients at any given time, where r is the number ofrows in the block of data values.

The processing performed by the processing units 614 may be Linear orHaar processing, e.g. depending upon the number of different inputs thatare provided in order to determine the second coefficients.

For blocks with a different number of rows (i.e. not eight rows as inthe example given above), a skilled person would know how to modify theorder of inputting the rows accordingly so that on each clock cycle(except the clock cycle in which the first row of a block is processed),data values can be output for a row based on previously stored rows ofdata values from the block which have been stored in the registers 612.

The spatial decorrelation modules 204 described above are configured toimplement spatial decorrelation along the rows of data values and thenalong the columns of data values, such that a row of spatiallydecorrelated values may be output on each of a plurality of consecutiveclock cycles. In other examples, the processing of rows and columns maybe swapped, such that the spatial decorrelation modules 204 implementspatial decorrelation along the columns of data values and then alongthe rows of data values, such that a column of spatially decorrelatedvalues may be output on each of a plurality of consecutive clock cycles.

The spatially decorrelated data values (i.e. the second coefficientsoutput from the processing units 614) are output from the spatialdecorrelation modules 204 and provided to the corresponding entropyencoding modules 206. An optional step of remapping of the data valuesoutput from the spatial decorrelation modules 204 before they areprovided to the entropy encoding modules 206 may be performed, e.g. ifit is determined that this will improve the entropy encoding process.For example, the data values output from the spatial decorrelationmodules 204 may be likely to have values close to zero, or close to themaximum value (e.g. 255 for 8-bit values) due to the spatialdecorrelation process, where it is noted that values close to themaximum value are used to represent negative values close to zero. Itcan therefore be considered that there are two peaks in the distributionof the data values output from the spatial decorrelation modules 204.Entropy encoding may be more efficient when there is just one peak inthe distribution of the data values. This can be achieved by remappingthe data values, e.g. by moving the sign bit (i.e. the first bit of thevalue) to the least significant bit position and if the original valuewas negative then flipping the other bits, but not flipping the otherbits if the original value was not negative. In this way the two peaksin the example described above would be grouped together into one peak,allowing more efficient entropy encoding to be performed. The remappingprocess could be implemented in any suitable manner that improves theefficiency of the entropy encoding process.

As described above, the entropy encoding modules 206 apply entropyencoding to the spatially decorrelated values using a variable-lengthcoding scheme. The coding scheme was chosen to allow for fast encoding,and in particular fast decoding of the data values, at predictablerates. For example, in the examples described in detail herein eightdata values are encoded in each of a plurality of consecutive clockcycles according to the entropy encoding scheme and eight data valuesare decoded in each of a plurality of consecutive clock cycles accordingto the corresponding entropy decoding scheme.

One example of a suitable entropy coding scheme is a coding scheme basedon exponential Golomb coding, and in particular based on the k=0 variantalso known as Elias coding. According to this coding scheme, the datavalues (or “symbols”) are encoded into encoded data values, eachcomprising a prefix of N+1 bits followed by a N bit binary value, whereN depends upon the symbol value. In the examples described in detailherein, the prefix bits have a format in accordance with unary codingsuch that the prefix bits include either: (i) a variable number ofzeroes followed by a one, or (ii) a variable number of ones followed bya zero. In other examples the prefix bits may have other formats. Due tothe processing of the data values (e.g. colour decorrelation and spatialdecorrelation), the distribution of the data values received at theentropy encoding modules 206 tends to be fairly “peaky”, which allowsfor efficient entropy encoding. For example, in the case that remappingis applied to the outputs of the spatial decorrelation modules 204 asdescribed above, the data values received at the entropy encodingmodules 206 are more likely to have lower values than higher values,such that e.g. a value of 0 is much more likely than a value of 255. Inan example described herein, the Elias coding scheme is slightlymodified, and FIG. 10 shows how the different data values (or “symbols”)correspond to the modified Elias codes. The values in the table shown inFIG. 10 are shown in big-endian order such that the MSBs are on the leftbecause this is how binary values are normally represented. However, itcan be appreciated that the values could have been represented inlittle-endian order such that the MSBs are on the right, and in factthat may better represent how the data is output, but for ease of humanunderstanding the values are represented in FIG. 10 with the MSBs on theleft. The modified Elias codes in the second column of the table in FIG.10 are written with the prefix first and the binary suffix, in bold,second. The leading prefix bit is underlined in the table shown in FIG.10. It can be seen that each N-bit suffix exactly matches the N LSBs ofthe corresponding symbol, which have been indicated in bold in thebinary representations of the symbol in FIG. 10. This simplifies themapping for both entropy encoding and decoding relative to conventionalElias coding. The length of the prefix indicates the length of thesuffix.

Since the coefficient ‘255’ would end up in a group in its own, having17 bits, it has been determined that in the examples described herein, adata value of 255 is not entropy encoded. Instead, if a row includes adata value of 255 then the data values of that row are output as rawdata values from the entropy encoder. This avoids the need to output a17-bit value. Furthermore, the expected probability of a data valuebeing 255 is very low due to the previous colour and spatialdecorrelation steps, and may for example be approximately 2⁻¹⁷ whenexponential Golomb coding is used, such that the chances of this datavalue occurring in a row is expected to be approximately 2⁻¹¹. There maybe a loss of efficiency when a row of data values are not entropyencoded because one of the data values in the row is 255, but since thisoccurs very infrequently (e.g. once per 2¹¹ rows) this loss ofefficiency is deemed acceptable.

In examples described in detail herein, the leading bit (i.e. the MSB)of the prefix (which is underlined in FIG. 10) is separated from theremainder of the encoded bits, and the remaining N prefix bits and Nsuffix bits are interleaved with each other, as shown in the final twocolumns of the Table in FIG. 10. There is a known relationship betweenthe number of prefix bits and the number of suffix bits in theinterleaved bits. In the example shown in FIG. 10, there are the samenumber of prefix bits and suffix bits in the interleaved bits.Therefore, in the interleaved bits, the even numbered bits will containpurely suffix information while the odd numbered bits will containpurely prefix information. In other examples, the relationship betweenthe number of prefix bits and the number of suffix bits may be differentand will depend upon the particular coding scheme used to encode thedata values, for example the interleaved bits may include twice as manysuffix bits as prefix bits (and may be interleaved into an order:prefix, suffix, suffix, prefix, suffix, suffix, . . . ). The splittingof the encoded data values into a separated leading bit and theinterleaved prefix and suffix bits may make negligible difference to thespeed at which the entropy encoder can operate, but it may potentiallymake a huge difference to the speed at which the entropy decoder canoperate as described in more detail below. The prefix and suffix bitsare separable from each other so that, when decoding, the prefix bitscan be analysed to find bit-boundaries without analysing the suffix bitsand then the bit-boundaries and the suffix bits can be used to determinedecoded data values. This significantly reduces the hardware cost fordecoding the data values in a parallel decoder. In the example describedabove, the prefix and suffix bits are interleaved which allows them tobe separable. In other examples, the prefix and suffix bits are notinterleaved, and are instead grouped separately into a block of suffixbits and a block of prefix bits which are independently accessible. Inother examples, other ways of separating the prefix and suffix bits maybe implemented.

As well as showing the encoding of specific symbols, some of the linesin FIG. 10 show general rules for encoding groups of symbols. Forexample, symbols 1 and 2 are represented in binary as 000000AB, wherefor a symbol value of 1, AB=01 and for a symbol value of 2, AB=10. Themodified Elias code for these symbols has a prefix of 01 and a suffix ofB, which is separated into the leading prefix bit 0 and the interleavedbits 1B. Similarly, symbols 3 to 6 are represented in binary as00000CDE, where for a symbol value of 3, CDE=011; for a symbol value of4, CDE=100; for a symbol value of 5, CDE=101; and for a symbol value of6, CDE=110. The modified Elias code for these symbols has a prefix of001 and a suffix of DE, which is separated into the leading prefix bit 0and the interleaved bits 0D1E. Similarly, symbols 7 to 14 arerepresented in binary as 0000FGHI, where for a symbol value of 7,FGHI=0111; for a symbol value of 8, FGHI=1000; and so on until we get toa symbol value 14 for which FGHI=1110. The modified Elias code for thesesymbols has a prefix of 0001 and a suffix of GHI, which is separatedinto the leading prefix bit 0 and the interleaved bits 0G0H1I. The wayin which the symbol values are encoded should be apparent from theseexamples.

FIG. 11 shows a more detailed view of one of the entropy encodingmodules 206. The entropy encoding module 206 comprises a plurality offirst encode units 1102 ₀ to 1102 ₇ which are configured to receive datavalues for the respective columns of the data block, which are to beencoded. For clarity, only the encode units 1102 ₀ and 1102 ₇ aredenoted with reference numerals in FIG. 11. The entropy encoding module206 also comprises a second encode unit 1104, a processing unit 1106, adata store 1108, e.g. implemented as an output First-In-First-Out (FIFO)memory 1108, and an encoding indicator unit 1110.

FIG. 12 shows a flow chart for a process of performing entropy encodingon data values at the entropy encoding module 206 to form a sequence ofentropy encoded data values. In step S1202 the data values of a row tobe encoded are received at the first encode units 1102 ₀ to 1102 ₇.

In step S1204 the entropy encoded data values for each of the receiveddata values are determined according to the modified Elias codingscheme. In order to do this the first encode units 1102 examine thereceived entropy encoded data values to determine: (i) an indication ofthe size of each of the entropy encoded data values, and (ii) the suffixbits for each of the encoded data values. As described above, the Nsuffix bits can be determined easily since they match the N LSBs of theunencoded data values. The size indications may be in binary format. Asan example, the size indications may represent the value of N. Since thetotal number of bits in the encoded data value excluding the leading bitis always an even number (e.g. 2N), it can be represented by dividingthis number by two (e.g. to give N), such that only three bits areneeded to represent the size in the example given above for 8-bit datavalues and modified Elias codes (having N−1 prefix bits and N suffixbits) which have a maximum number of bits of 15 (such that the largestsize indication, N_(max), is 7, which can be represented using justthree binary bits). The second encode unit 1104 receives the suffix bitsand the size indications from each of the first encode units 1102 andgenerates the prefix bits (excluding the leading bits). The prefix bitsare determined based on the size indications of the entropy encoded datavalues. In step S1206, the second encode unit 1104 interleaves thesuffix and prefix bits (excluding the leading bits) as described aboveand shown in the last column of the table in FIG. 10. The second encodeunit 1104 may comprise a plurality of separate processing units whichare configured to process the outputs from different ones of the firstencode units 1102, such that a whole row of data values can be encodedin each of a plurality of consecutive clock cycles. The interleaving ofthe suffix and prefix bits means that each of the bit locations in thesequence of entropy encoded data values is predetermined by the entropycoding scheme to include either a first bit or a second bit. This can beachieved in other ways in other examples. For example, if the prefix andsuffix bits are not interleaved, and are instead grouped separately intoa block of suffix bits and a block of prefix bits which areindependently accessible, each of the bit locations in the sequence ofentropy encoded data values is predetermined by the entropy codingscheme to include either a first bit or a second bit. This allows thefirst and second bits in the sequence of entropy encoded data values tobe separated during entropy decoding simply based on the bit locationsof the bits, as described in more detail below.

In step S1208 the size indications are provided from the first encodeunits 1102 to the processing unit 1106, and the processing unit 1106determines and groups the leading bits of the encoded data values into afirst field in accordance with the entropy coding scheme being used. Asdescribed in relation to the example given above, the prefix bits(excluding the leading bits) and the suffix bits are interleaved witheach other in an alternating manner and included in a second field. Ascan be appreciated by looking at the table in FIG. 10, according to themodified Elias coding scheme used in the examples described in detailherein, if a size indication is zero then the unencoded data value iszero and the encoded data value will have a single prefix bit of 1 andno suffix bits, such that the leading bit is a 1. However, according tothe modified Elias coding scheme used in the examples described indetail herein, if the size indication is not zero then the unencodeddata value is not zero and the encoded data value will have a prefixwith more than one bit such that the leading bit (i.e. the MSB of theprefix) will be a 0. Therefore the determination of the leading bit inthe processing unit 1106 may be implemented simply by determiningwhether the size indications are zero or non-zero.

The encoding indicator unit 1110 receives the size indications and setsan indicator to indicate the coding scheme used to encode the datavalues. In a simple example, the indicator may be a single bit for eachrow indicating whether the data for that row is to be entropy encoded oroutput as raw data (i.e. not entropy encoded). For example, the codingscheme used may be determined based on whether the size indications forthe entropy encoded data values indicate that the entropy encoded datavalues of a row will use fewer bits than the raw data values of the row(i.e. based on whether fewer than 64 bits are to be used for the eightentropy encoded data values of the row in the example in which theunencoded data values each have eight bits).

The encoded data values (including interleaved prefix and suffix bitsfrom the second encode unit 1104 and the leading bits from theprocessing unit 1106) of the rows are sent to the output FIFO 1108 andare stored therein in step S1210. On each of a plurality of consecutiveclock cycles a row of encoded data values are stored in the output FIFO1108 until all of the data values within a block of encoded data values(e.g. 8 rows) have been encoded. Then, in step S1212, the block ofencoded data values is output from the output FIFO 1108 and sent to thepacking module 208, where the encoded data values from each of thecolour channels are packed together. In this way, a sequence of encodeddata values has been formed. The encoded data block can then be sent forstorage in the memory 106, e.g. via the memory interface 114.

As described above, if the encoded data values for a row are not goingto comprise fewer bits than the raw (i.e. unencoded) data values thenthe raw data values are output instead of the entropy encoded datavalues. The indicator (raw or entropy encode flag) output from theencoding indicator unit 1110 is provided to the output FIFO 1108. Theoutput FIFO 1108 also receives the raw bits (i.e. the bits of the rowthat were received at the first encode units 1102 ₀ to 1102 ₇). The rawdata for an 8×8 block of 8-bit data values comprises 512 bits, so if theoutput FIFO 1108 determines that the block of encoded data valuescomprises 512 bits (which is unlikely but possible) then the output FIFO1108 may output the raw data bits rather than the block of encoded datavalues.

FIG. 15 represents a data packet into which the packing module 208 maypack an 8×8 block of encoded data values (wherein the unencoded datavalues each comprise 8 bits per colour channel) which have been encodedas described above. The data of each of the colour channels (e.g. R, G,B and A channels) comprise up to 512 bits and are stored in respectiveblocks in a data portion of the data packet. In the example shown inFIG. 15, where there are M colour channels, for channels 0 to M−2 thereare respective size indicators (e.g. of 7 bits each) to indicate thenumber of bits of data for the respective channel. The size indicatorsare used to determine the starting position of the data of each of thechannels and to determine the format of the data of the channels. Forexample, the channel 1 data will start at the bit position given by theoffset from the start of the data portion corresponding to the size ofchannel 0. It is not necessary to have a size indicator for channel M−1since there are no subsequent channels. However, the format of the dataof channel M−1 still needs to be indicated, so two bits are included inthe control portion to indicate the format of the data of channel M−1.Some number of padding bits (e.g. between 0 and 3) are included in thecontrol portion to ensure that the data portion starts at a bit positionwhich is divisible by four. The exact sizes of the channel data blocksmay be given by 9 bit size indicators (that is, 9 bits may be needed toexactly represent a size from 1 to 512 bits). However, as shown in FIG.15 the size indicators are given by dividing the size by four such thatonly 7 bits are used. It can be appreciated that the entropy encodingscheme described above will always use an even number of bits and soonly eight bits would be needed to exactly represent the size of thechannel data blocks. Furthermore, the channel data blocks may includepadding bits (which are not explicitly shown in FIG. 15) to pad thechannel data blocks up to the nearest multiple of four bits, such thatall of the channel data blocks start at a position which is a multipleof four bits. Assuming equal probability, this means that 50% of thetime we will waste two bits. On average, therefore, the scheme wastesone bit of storage, which exactly balances the saving of one bit in thesize indicators (i.e., the reduction from 8 to 7 bits). However, because(a) the summation of the sizes and (b) the muxing/shifting used toselect the channel data, are reduced, this scheme is simpler/cheaper toimplement than using 8 bits for the size indicators.

To identify the special case of the channel data being stored in a rawform (which effectively means the entropy encoded data was >508 bits) asize value of “0” may be used. The smallest standard entropy encodeddata is 74-bits in size which corresponds to a (rounded up) sizeindicator of 19 (since 19×4=76). Therefore, size indicators between 1and 18 inclusive could be used to indicate other special cases. Forexample, a size indicator of 2 may indicate that the data values in thedata block of the channel have a constant value and the size of thechannel data block in the data portion is eight bits. As describedabove, for the final channel (channel M−1), it is unnecessary to knowits exact size as it is not necessary to locate the data stored afterit, but an indicator is used to indicate the format of the data inchannel M−1, e.g. whether it is in a raw format, encoded with theentropy scheme, or a constant, and as such two bits are used to indicatethis format.

Similar data structures may be used when different sized data blocks(e.g. not 8×8 blocks) are encoded and/or when each data value isrepresented using a different number of bits (e.g. not 8 bits).

Furthermore, in another example, the number of size indicators may behalved by making each size indicator indicate the size of a pair ofchannels. Any reduction in the number of bits used to store the controldata may be a benefit in a data compression scheme, so reducing thenumber of size indicators used may be beneficial. For example, a firstsize indicator may indicate the combined size of channels 0 and 1, and asecond size indicator may indicate the combined size of channels 2 and3, etc. In this case, the data blocks for the odd channels may beincluded in the data portion in reverse bit-order, whilst the datablocks for the even channels may be included in the data portion inforward bit-order. In this way, for the even channels the sizeindicators can be used to indicate the start of the channel data, andthe even channels can be read out in the same way as before, by addingup the size of the previous channels to determine the start of thechannel data. However, for the odd channels the size indicators can beused to indicate the end of the block of channel data. Since the datablocks of the odd channels are in reverse bit-order, the end of theblock of the channel data indicates the start of the channel data, i.e.the first bit of the channel data. The channel data of the odd channelscan then be read according to the reverse bit-order (i.e. “backwards”)from the end point of the block of channel data. Since the channel datafor odd channels has been stored in reverse bit-order in the data packetthen the channel data is read out correctly. In this way, the positionof the first bit of the data in the odd channels is determined from theposition of the next even channel.

The method of storing fewer (e.g. half) of the size indicators can beused for any type of data that is stored in a data packet whereindifferent blocks of data are included in the data packet. Sizeindicators are an example of indicators which indicate the starting bitposition of the data blocks in the data packet, but more generally, anysuitable indicators may be used. At least one of the indicators mayindicate a particular starting bit position for a pair of the datablocks in the data packet. A first data block of the pair of data blocksmay be included in reverse bit-order in the data packet with the firstbit of the first data block being positioned in the data packet inaccordance with the indicated particular starting bit position. A seconddata block of the pair of data blocks may be included in forwardbit-order in the data packet with the first bit of the second data blockbeing positioned in the data packet in accordance with the indicatedparticular starting bit position. The indicators are included in thedata packet, e.g. in a control portion of the data packet, whilst thedata blocks are included (e.g. in a contiguous manner) in a data portionof the data packet. In order to read the data blocks from the datapacket the indicators are used to determine the starting bit position ofthe data blocks in the data packet, and the data blocks are read fromthe data packet in accordance with the determined starting bit positionof the data blocks.

FIG. 16 shows an example in which there are five data blocks, (e.g.which represent data for different channels) labelled data block 0 todata block 4 included in a data portion of the data packet. There arejust two indicators in the control portion, which indicate the bitpositions of the boundaries between data blocks 1 and 2 and between datablocks 3 and 4. The dotted lines show the order in which the bits of thedata blocks are arranged. In particular, the even data blocks (datablocks 0, 2 and 4) are included in forward bit-order whilst the odd datablocks (data blocks 1 and 3) are included in reverse bit-order. In orderto read data block 0, the first bit can be found at the start of thedata portion of the data packet. In order to read data block 1, thefirst indicator (indicating the combined size of data blocks 0 and 1) isused to find the boundary between data blocks 1 and 2. The first bit ofdata block 1 is found at this bit position (or e.g. one bit before thisbit position) and then the data block 1 can be read out in reverse orderfrom that bit position. In order to read data block 2, the firstindicator (indicating the combined size of data blocks 0 and 1) is usedto find the boundary between data blocks 1 and 2. The first bit of datablock 2 is found at this bit position (or e.g. one bit after this bitposition) and then the data block 2 can be read out in forward orderfrom that bit position. The odd data blocks (including data block 3) areread out as described above for data block 1. The even data blocks(including data block 4) are read out as described above for data block2. In this example, the bit order of the data blocks (i.e. forward orreverse) is determined simply by determining whether the data block isodd or even before reading out the data block.

In this way the number of bits used for the indicators is reduced ascompared to a data packet such as that shown in FIG. 15 in which thereis an indicator for each boundary between data blocks in the dataportion of the data packet. In the example shown in FIG. 16 all of theindicators in the control portion of the data packet indicate thestarting bit position for a pair of data blocks and as such half thenumber of indicators are used in the control portion, thereby reducingthe amount of data included in the data packet. It is not significantlymore complex (if at all) to include or read the data blocks in reversebit-order compared to including or reading the data blocks inforward-bit order. It is the packing module 208 that forms the datapacket, and it is the unpacking module 408 that reads the data blocksfrom the data packet. It is noted that if the last channel is an oddchannel then there won't be a channel after the last odd channel, andthe last size indicator will indicate the end of the data packet. Forexample, if data block 4 wasn't included in the data packet shown inFIG. 15 then we would still need the size indicator for blocks 2 and 3which would point to the end of block 3 in order to find the start ofthe data in data block 3.

FIG. 17 illustrates how the data of a channel is stored in a data blockof encoded data values in the example of an 8×8 block of 8 bit datavalues. The channel data comprises a block of data for each of the rows(which has between 8 and 64 bits) and a row mode flag for each of therows which indicates whether the data values of the respective rows arein raw format or have been entropy encoded. In particular, in theexample shown in FIG. 17, if the row mode flag for a particular row is a0 then the data values of that row are in raw format and the data forthat row comprises eight raw data values having eight bits each in thisexample. However, if the row mode flag for a particular row is a 1, inthe example shown in FIG. 17, then the data values of that row areentropy encoded and as such include eight leading entropy bits andbetween 0 and 54 interleaved prefix and suffix bits as described above.

FIG. 13 illustrates any one of the entropy decoding modules 406 which isused to perform entropy decoding on a plurality of entropy encoded datavalues which have been entropy encoded as described above. The entropydecoding module 406 comprises a shift unit 1302, a leading entropy unit1304, a prefix bit window 1306, a suffix bit window 1308, seven paralleldecode units 1310 ₀ to 1310 ₆, three first-level merging units 1312 ₀ to1312 ₂, two second-level merging units 1314 ₀ and 1314 ₁ and athird-level merging unit 1316. An output of the shift unit 1302 iscoupled to inputs of the prefix bit window 1306 and the suffix bitwindow 1308. Seven outputs of the prefix and suffix windows 1306 and1308 are coupled to respective inputs of the seven parallel decode units1310 ₀ to 1310 ₆. Outputs of the first and second decode units 1310 ₀and 1310 ₁ are coupled to inputs of the first of the first-level mergingunits 1312 ₀. Outputs of the third and fourth decode units 1310 ₂ and1310 ₃ are coupled to inputs of the second of the first-level mergingunits 1312 ₁. Outputs of the fifth and sixth decode units 1310 ₄ and1310 ₅ are coupled to inputs of the third of the first-level mergingunits 1312 ₂. Outputs of the first and second of the first-level mergingunits 1312 ₀ and 1312 ₁ are coupled to inputs of the first of thesecond-level merging units 1314 ₀. Outputs of the third of thefirst-level merging units 1312 ₂ and the seventh decode unit 1310 ₆ arecoupled to inputs of the second of the second-level merging units 1314₁. Outputs of the first and second of the second-level merging units1314 ₀ and 1314 ₁ are coupled to inputs of the third-level merging unit1316. An output of the leading entropy unit 1304 is coupled to an inputof the third-level merging unit 1316. A first output of the third-levelmerging unit 1316 is provided as an output of the entropy decodingmodule 406. A second output of the third-level merging unit 1316 iscoupled to an input of the prefix and suffix bit windows 1306 and 1308.A third output of the third-level merging unit 1316 is coupled to aninput of the shift unit 1302.

The operation of the entropy decoding module 406 is described withreference to the flow chart shown in FIG. 14. In step S1402 a block ofdata is received at the entropy decoding module 406. If the data valuesare in raw format then the data values bypass the units of the entropydecoding module 406 shown in FIG. 13 and the raw data values are outputfrom the entropy decoding module 406 to the corresponding reversespatial decorrelation module 404. However, if the received data valuesare entropy encoded (as indicated by the row mode flags shown in FIG.17) then the entropy decoding module 406 performs entropy decoding onthe received data values, as described below with reference to the stepsshown in the flow chart of FIG. 14.

The entropy encoded data values of a row are received at the entropydecoding unit 406, and the leading entropy bits of the entropy encodeddata values are provided to the leading entropy unit 1304. In step S1404the remaining, interleaved prefix and suffix bits (i.e. the bits otherthan the leading bits) are de-interleaved in accordance with the entropycoding scheme used to encode the data values and the prefix bits areprovided to the prefix bit window 1306 whilst the suffix bits areprovided to the suffix bit window 1308. It is noted that in examples inwhich the prefix and suffix are not interleaved when they are encoded,then they do not need to be de-interleaved in step S1404, and insteadcan be provided to the prefix bit window 1306 and the suffix bit window1308 accordingly. Therefore, in general, the first bits of the entropyencoded data values are separated from the second bits of the entropyencoded data values based on the bit locations of the bits (e.g. and notbased on an analysis of the values of those bits) in the sequence ofentropy encoded data values in accordance with the entropy codingscheme. In the example shown in FIG. 13, the prefix bit window 1306 andthe suffix bit window 1308 are both 27 bits long. In this way, theprefix and suffix bits for a whole entropy encoded row can be stored inthe windows 1306 and 1308. It is noted that the maximum number of bitsthat would be used for an entropy encoded row is 62 bits (62 bits=8leading prefix bits+27 other prefix bits+27 suffix bits), because ifmore bits are needed for entropy encoding then raw data values will beused instead for the row, which uses 64 bits. According to the entropycoding scheme described in detail in examples above, the number ofprefix bits (minus the leading entropy bits) is the same as the numberof suffix bits, so the number of bits (e.g. N) provided to the prefixbit window 1306 is the same as the number of bits (e.g. N) provided tothe suffix bit window 1308 for each of the data values. In the exampledescribed above in which the leading entropy bits are grouped togetherinto a first field and the remaining prefix and suffix bits areinterleaved with each other in an alternating manner in a second field,the de-interleaving of the prefix and suffix bits from the second fieldcomprises splitting the odd bits from the even bits of the data in thesecond field to thereby form a stream of prefix bits and a correspondingstream of suffix bits which are provided to the prefix bit window 1306and the suffix bit window 1308 respectively.

In each of a plurality of consecutive clock cycles, a row of entropyencoded data values (e.g. eight entropy encoded data values) areprocessed by the entropy decoding module 406. With reference to theexample of the coding scheme shown in FIG. 10, it can be seen that if aleading entropy bit is ‘1’ then that indicates that the data value is 0and there will be no prefix or suffix bits provided to the prefix andsuffix bit windows 1306 and 1308 for those data values. However, forother entropy encoded data values, which have leading entropy bits of‘0’ such that prefix and suffix bits are provided respectively to theprefix and suffix bit windows 1306 and 1308, prefix bits of ‘1’ in theprefix bit window 1306 indicate the end of an entropy encoded datavalue, whilst prefix bits of ‘0’ indicate that there are more prefixbits in a particular entropy encoded data value.

In step S1406 the de-interleaved prefix bits (and the de-interleavedsuffix bits) are split into sections (e.g. each section comprising fourprefix bits and four suffix bits), and each section is provided to arespective one of the decode units 1310. This is indicated in full inFIG. 13 for decode unit 1310 ₀ which shows “2×4” bits going to thedecode unit 1310 ₀ (i.e. four prefix and four suffix bits). The same istrue for the other decode units 1310 ₁ to 1310 ₆, but to avoidcluttering the Figure this is shown in shorthand in FIG. 13 as “8” bitsrather than “2×4” bits.

In step S1408 each of the decode units 1310 analyses the prefix bits todetermine bit-boundaries between the entropy encoded data values. Bydetermining the bit-boundaries between the entropy encoded data values,the lengths of the entropy encoded data values are determined. Inparticular, in the example using the coding scheme shown in FIG. 10, thedecode units 1310 identify prefix bits having a value of ‘1’ since thisindicates a bit-boundary in the prefix bits. Since in this example, thenumber of prefix bits (minus the leading entropy bits) is the same asthe number of suffix bits (e.g. N), then the bit-boundaries in theprefix bits are the same as the bit-boundaries in the suffix bits. Ifother coding schemes are used, then the bit boundaries in the suffixbits may be determined based on other relationships between the numbersof prefix and suffix bits for each of the entropy encoded data values,as determined by the particular entropy coding scheme.

In step S1410 the suffix bits and the determined bit-boundaries are usedto decode the entropy encoded data values in accordance with theparticular entropy coding scheme that was used to encode the datavalues. In particular, for any of the data values which finish within adecode unit 1310 (as indicated by a ‘1’ in the prefix bits), that decodeunit 1310 outputs a candidate decoded symbol value using the suffix bitsthat it is access to. However, since a decode unit 1310 might not haveaccess to all of the suffix bits of a particular symbol (because theprevious decode unit(s) 1310 might have received some of the suffix bitsof the particular symbol, the candidate decoded symbol value might notbe the final decoded symbol value. The merging units 1312, 1314 and 1316ensure that the final decoded symbol values take account of all of thebits of the symbols. As described above, the entropy coding scheme ischosen such that the decoded symbols are easily determined using thesuffix bits since the N LSBs of the binary representation of the decodedsymbols are the same as the N bits as the binary bits of the suffix ofthe encoded data values. The decode units 1310 also output carry outbits for data values which start but do not finish within the decodeunit 1310. The carry out bits are the suffix bits of the data valuesreceived at the decode unit 1310 which do not finish within the decodeunit 1310. The carry out bits allow the merging units 1312 to combinethe outputs of the decode units 1310 to determine data values whose bitshave been passed to more than one of the decode units 1310.

By way of example, if a decode unit 1310 receives the four prefix bits[0100], then reading from left to right, it can determine that the firsttwo prefix bits are the final two prefix bits (but not necessarily theonly two prefix bits) of one data value and the next two prefix bits arethe start (but not the end) of the next data value. The four suffix bitsreceived at the decode unit 130 may be denoted as [S₀,S₁,S₂,S₃]. Thedecode unit 1310 outputs a candidate decoded symbol value as [S₀,S₁] andan indicator which can be used by the subsequent merging unit 1312 whichindicates the length of the candidate decoded symbol value (e.g. in thisexample as 2 bits). [S₀,S₁] will be the final two bits of the decodeddata value but the merging units 1312, 1314 and 1316 still need todetermine the rest of the bits (e.g. the other six bits in an exampleusing 8-bit data values) of the decoded data value. The bits S₂ and S₃are not the final suffix bits of a data value (because the final prefixbits in this example are both zero). So the carry out bits from thedecode unit 1310 comprise S₂ and S₃, and an indicator is output form thedecode unit 1310 to the subsequent merging unit 1312 which indicates thelength of the carry out bits (e.g. in this example as 2 bits). Themerging unit 1312 can then combine the suffix bits S₂ and S₃ with theoutput of another decode unit 1310 in order to determine the decodeddata values.

The merging units 1312, 1314 and 1316 combine the results of theanalysis of the sections to determine all of the decoded data values fora row. In particular, the merging unit 1312 ₀ receives the candidatedecoded symbols and/or the carry out bits from the two decode units 1310₀ and 1310 ₁ and combines them to then output further candidate decodedsymbols and/or carry out bits to the merging unit 1314 ₀. For example,the carry out bits from the decode unit 1310 ₀ are combined with thefirst output bits from the decode unit 1310 ₁ to thereby determine acandidate decoded value for a symbol whose encoded bits fell partly inthe section processed by the decode unit 1310 ₀ and partly in thesection processed by the decode unit 1310 ₁.

Following on from the example given above, the merging unit 1312 ₀ mayreceive from the decode unit 1310 ₀ a candidate decoded symbol which hastwo bits, e.g. [S₀,S₁] and two carry out bits [S₂,S₃], with indicationsof the lengths of the candidate decoded symbol and the carry out bits.The merging unit may also receive from the decode unit 1310 ₁ twocandidate decoded symbols which respectively have one and three bits,[S₄] and [S₅,S₆,S₇]. The merging unit 1312 ₀ will combine the carry outbits [S₂,S₃] from the decode unit 1310 ₀ with the bit S₄ of the firstcandidate decoded symbol output from the decode unit 1310 ₁. Therefore,in this example, the merging unit 1312 ₀ has determined three candidatedecoded symbols with final bits of [S₀,S₁], [S₂,S₃,S₄] and [S₅,S₆,S₇]respectively. The decoded data symbols in this example have eight bits,so the merging unit 1312 ₀ will need to add bits to the candidatedecoded symbols such that they have eight bits. It can be seen from FIG.10 that the bits of the decoded symbols include a number of suffix bits(denoted S) and (8-S) other bits. The first (8-S-1) of the other bitsare zeroes. The last bit of the other bits (i.e. the right most bit ofthe other bits of the symbols) is a zero if all of the suffix bits areones, and the last bit of the other bits is a one if it is not the casethat all of the suffix bits are ones. In this way the merging unit 1312₀ can determine the decoded symbols by combining the carry out bits fromthe decode unit 1310 ₀ with the bits of the first candidate decodedsymbol from the decode unit 1310 ₁ to determine a decoded symbol.

The merging unit 1312 ₁ processes the outputs from the decode units 1310₂ and 1310 ₃, and the merging unit 1312 ₂ processes the outputs from thedecode units 1310 ₄ and 1310 ₅ in a corresponding manner to theprocessing of the outputs from the decode units 1310 ₀ and 1310 ₁ by themerging unit 1312 ₀ as described above.

There may be some data values whose bits fall partly into more than oneof the merging units 1312. Therefore, further layers of merging units1314 and 1316 are used to combine all of the bits of the row together toensure that the bits are decoded correctly. For example, the mergingunit 1314 ₀ combines the outputs of the merging units 1312 ₀ and 1312 ₁and outputs between two and eight decoded symbols and optionally somecarry out bits. Also similarly, the merging unit 1314 ₁ combines theoutputs of the merging unit 1312 ₂ and the decode unit 1310 ₆ andoutputs up to six decoded symbols. The merging unit 1314 ₁ may or maynot output any carry out bits because there are no subsequent bits forsuch carry out bits to be combined with in the current row, but suchcarry out bits may be useful for processing subsequent rows of datavalues.

The merging unit 1316 then combines the outputs of the merging units1314 ₀ and 1314 ₁ with the leading entropy bits from the leading entropyunit 13104 to determine and output the eight decoded data values (or“symbols”) of the row.

It is noted that the determination of the bit-boundaries between thereceived entropy encoded data values does not comprise analysing thesuffix bits. The number of bits that need to be considered whendetermining the bit-boundaries is reduced (e.g. halved) because thesuffix bits are not considered. The determination of the bit boundariesbetween entropy encoded data values can be performed in parallel (e.g.in the decode units 1310) for the different data values of a row since:(i) only the prefix bits are considered for this purpose, and (ii) theformat of the prefix bits means that any ‘1’s in the prefix bitsindicate bit-boundaries. Therefore, to find bit-boundaries the decodeunits 1310 simply find ‘1’s in the prefix bits. Therefore, a sequentialnature of the processing of the variable-length entropy encoded datavalues is avoided by removing the suffix bits from the determination ofthe bit-boundaries. This allows a plurality of entropy encoded datavalues to be decoded on each iteration (e.g. on each of a plurality ofconsecutive clock cycles).

The method steps described above with reference to the flow chart ofFIG. 14 are iterated on each of a plurality of consecutive clock cycles.For example, a row of entropy encoded data values (e.g. eight entropyencoded data values) are decoded on each of the clock cycles.

In the examples described above, for any given entropy encoded datavalue, the number of prefix bits is N+1 and the number of suffix bits isN. In more general examples, the relationship between the number ofprefix bits and the number of suffix bits for any given entropy encodeddata value is such that the number of prefix bits is (N+a) and thenumber of suffix bits is kN, where a is a constant which describes thenumber of leading bits which are to be treated differently to the otherremaining prefix bits, as described in detail in the examples above inwhich a=1; and k is a constant which describes the number of suffix bitsthat are included for each of the remaining prefix bits. In the examplesdescribed in detail above k=1.

For example, an encoding scheme could be used in which a=0 and k=1, suchthat the entropy encoded data values have an even length with the numberof prefix bits equaling the number of suffix bits. With a=0 there are noleading prefix bits, and all of the prefix bits are treated in the sameway. An example of the prefix and suffix bits which could be used toencode different symbols in this case is given in Table 1.

TABLE 1 Binary Representation Symbol of symbol Prefix Suffix 0 0000 00001 0 1 0000 0001 1 1 2 0000 0010 01 10 3 0000 0011 01 11 4 0000 0100 0100 5 0000 0101 01 01 6 0000 0110 001 110 7 0000 0111 001 111 8 0000 1000001 000 9 0000 1001 001 001 10  0000 1010 001 010 11  0000 1011 001 01112  0000 1100 001 100 13  0000 1101 001 101 Etc. Etc. Etc. Etc.

In the example shown in Table 1, the N suffix bits match the N LSBs ofthe binary representation of the symbol, which may provide an advantageas described above in relation to the table shown in FIG. 10. However,in other examples, the suffix bits might not match the LSBs of thebinary representation of the symbol, and, for example, may insteadincrement from zero to (2^(N)−1) for each value of N.

As another example, an encoding scheme could be used in which a=0 andk=2, such that the entropy encoded data values have an even length withthe number of prefix bits being half the number of suffix bits. Anexample of the prefix and suffix bits which could be used to encodedifferent symbols in this case is given in Table 2.

TABLE 2 Binary Representation Symbol of symbol Prefix Suffix 0 0000 00001 00 1 0000 0001 1 01 2 0000 0010 1 10 3 0000 0011 1 11 4 0000 0100 010100 5 0000 0101 01 0101 6 0000 0110 01 0110 7 0000 0111 01 0111 8 00001000 01 1000 9 0000 1001 01 1001 10  0000 1010 01 1010 11  0000 1011 011011 12  0000 1100 01 1100 13  0000 1101 01 1101 Etc. Etc. Etc. Etc.In the example shown in Table 2, the 2N suffix bits match the 2N LSBs ofthe binary representation of the symbol, which may provide an advantageas described above in relation to the table shown in FIG. 10. However,in other examples, the suffix bits might not match the LSBs of thebinary representation of the symbol, and, for example, may insteadincrement from zero to (2^(2N)−1) for each value of N.

The choice of which entropy coding scheme to use can be made based onthe type of data, which would be chosen based on the probability of thedifferent symbols/data values. For example, image data may be codedusing a different entropy coding scheme to other types of data. Ideallya symbol, S_(i), with probability P_(i), would have a code length,L_(i), such that P_(i)≈2^(−L) ^(i) .

In the examples shown above, the prefixes have a format in accordancewith unary coding and comprise a ‘1’ and a variable number of ‘0’s. Itis noted that in other examples, the ‘1’s and ‘0’s of the prefix valuesmay be swapped such that the prefixes comprise a ‘0’ and a variablenumber of ‘1’s. Furthermore, the endianness/bit ordering of the prefixand suffix bit may be altered to that described in the examples above.

The decoded data values from the entropy decoding modules 406 areprovided to the corresponding spatial recorrelation modules 404. Thespatial recorrelation modules 404 perform the reverse of the spatialdecorrelation described above in relation to FIGS. 6 to 9. Details of anexample of the operation of a spatial recorrelation module 404 aredescribed with reference to FIGS. 18 and 19.

FIG. 18 shows the spatial recorrelation module 404 comprising eightprocessing pipelines 1802 ₁ to 1802 ₈, which on each iteration (e.g.each clock cycle), each receive one of the entropy decoded data valuesfrom a row of data values (denoted A″ to H″ in FIG. 18). For thepurposes of the spatial recorrelation module the entropy decoded datavalues are considered to be spatially decorrelated data values on whichspatial recorrelation is to be applied to determine spatiallyrecorrelated data values. Each processing pipeline 1802 includes a firststage 1804 and a second stage 1806. Each of the first stages 1804includes a processing unit 1808 and a store 1810 for performing spatialrecorrelation in the vertical dimension (e.g. over columns). Each of thesecond stages 1806 includes a processing unit 1812 for performingspatial recorrelation in the horizontal dimension (e.g. over rows). Incontrast to the encoding pipelines 604 shown in FIG. 6, there is adependency chain in the second stages 1806 of the decoding pipelines1802, whereby the second stages 1806 of some of the pipelines 1802 usethe results of the second stages 1806 of other pipelines 1802, asdescribed in more detail below.

FIG. 19 illustrates the operation of the first stage 1804 of one of theprocessing pipelines 1802 over eight iterations to thereby output firstcoefficients to the respective second stages 1806 for an 8×8 block ofincoming spatially decorrelated data values. The first stages 1804 ofthe spatial recorrelation module 404 perform the inverse of theoperations performed by the second stages 608 of the correspondingspatial decorrelation module 204. The rows of a block of spatiallydecorrelated data values are input to the parallel processing pipelines1802 in an order such that after a first one of the rows has beenreceived by the first stages 1804 and stored in the registers 1810, thefirst coefficients of each subsequent row of the block that is receivedat the first stages 1804 can be determined based on the stored firstcoefficients in the registers 1810. For example, as described in moredetail below, the rows of an 8×8 block of spatially decorrelated datavalues may be supplied to the processing pipelines 1802 in the order:row 0, row 4, row 6, row 7, row 5, row 2, row 3 and then row 1.

It can be seen that the processing unit 1808 has three inputs labelled“Input”, “Left” and “Right” in FIG. 19, whereby the spatiallydecorrelated data values are received on the Input line, whereas theleft and right inputs are coupled to outputs of the registers 1810. On afirst clock cycle (clock cycle C0), the first stages 1804 of thepipelines 1802 receive the spatially decorrelated data values for row 0(the spatially decorrelated data value input to the second stage 1804 isindicated in FIG. 19 by a double prime: 0″) and output the firstcoefficients for row 0 (the value output from the second stage 1804 isindicated in FIG. 19 by a single prime: e.g. 0′), wherein the storageunits 1810 store the first coefficients for row 0 (i.e. following clockcycle C0, the registers 1810 store the first coefficients for row 0,denoted 0′).

On a second clock cycle (clock cycle C1), the first stages 1804 of thepipelines 1802 receive the spatially decorrelated data values for row 4(the spatially decorrelated data value input to the first stage 1804 is4″) and output the first coefficients for row 4 (the value output fromthe second stage 608 is 4′). That is, the processing unit 1808 receives4″ on the Input line and receives 0′ on the left and right inputs, suchthat the first coefficients for row 4 (denoted 4′) are determined by theprocessing units 1808 based on the received spatially decorrelated datavalues for row 4 (denoted 4″) and the stored first coefficients for row0 (denoted 0′, retrieved from the registers 1810). As described above,in the spatial decorrelation, the spatially decorrelated values for row4 are determined as

4″=4′−0′ mod 2⁸,

so rearranging this we get:

4′=4″+0′ mod 2⁸.

The processing unit 1808 uses this equation to determine the valuesdenoted 4′ based on the input values of 4″ and the stored firstcoefficients 0′. Following clock cycle C1 the storage units store thefirst coefficients for rows 0 and 4 (denoted 0′ and 4′).

On a third clock cycle (clock cycle C2), the first stages 1804 of thepipelines 1802 receive the spatially decorrelated data values for row 6(the value input to the second stage 1804 is 6″) and output the firstcoefficients for row 6 (the value output from the second stage 1804 is6′). That is, the processing unit 1808 receives 6″ on the Input line andreceives 4′ on the left and right inputs, such that the firstcoefficients for row 6 (denoted 6′) are determined by the processingunits 1808 based on the received spatially decorrelated data values forrow 6 (denoted 6″) and the stored first coefficients for row 4 (denoted4′, retrieved from the registers 1810). As will be apparent, the values6′ are determined according to the equation: 6′=6″+4′ mod 2⁸. Followingclock cycle C2 the registers 1810 store the first coefficients for rows0, 4 and 6, denoted 0′, 4′ and 6′).

As will be apparent, on a fourth clock cycle (clock cycle C3), the firststages 1804 of the pipelines 1802 receive the spatially decorrelateddata values for row 7 (denoted 7″) and output the first coefficients forrow 7 (denoted 7′). That is, the processing unit 1808 receives 7″ on theInput line and receives 6′ on the left and right inputs. The values 7′are determined according to the equation: 7′=7″+6′ mod 2⁸. Followingclock cycle C3 the registers 1810 store the first coefficients for rows0, 4 and 6, denoted 0′, 4′ and 6′).

As will be apparent, on a fifth clock cycle (clock cycle C4), the firststages 1804 of the pipelines 1802 receive the spatially decorrelateddata values for row 5 (denoted 5″) and output the first coefficients forrow 5 (denoted 5′). That is, the processing unit 1808 receives 5″ on theInput line, receives 4′ on the left input and receives 6′ on the rightinput. The values 5′ are determined according to the equation:5′=5″+LPredict(4′,6′) mod 2⁸. Following clock cycle C4 the registers1810 store the first coefficients for rows 0 and 4, denoted 0′ and 4′).The first coefficient for row 6 (denoted 6′) may be discarded because itis not needed for subsequent rows, but it may be simpler to leave 6′ inthe registers 1810 until it is overwritten.

The operation of the first stages 1804 on the sixth, seventh and eighthclock cycles will be apparent from FIG. 19 and will follow the sameprinciples as described above for first five clock cycles, and so forconciseness we will not explain the operation in these clock cycles indetail here. It is noted that the storage unit 1810 of each of the firststages 1804 of the processing pipelines 1802 is configured to store upto three first coefficients, and this is sufficient for the processingof all of the rows in the first stages 1804 due to the order in whichthe rows are input to the spatial recorrelation module 404. As notedabove, in general, each of the registers 1810 will have the capacity tostore up to log₂(r) first coefficients at any given time, where r is thenumber of rows in the block of spatially decorrelated data values.

Therefore, in each iteration, a row of first coefficients (labelled A′to H′ in FIG. 18) is provided to the respective second stages 1806 ofthe processing pipelines 1802. The second stages 1806 of the spatialrecorrelation module 404 perform the inverse of the operations performedby the first stages 606 of the corresponding spatial decorrelationmodule 204.

As described above in the spatial decorrelation, the data values ofcolumn A are the same as the first coefficients for column A, i.e. A′=A.Therefore, in the corresponding spatial recorrelation, the firstcoefficients for column A received at the second stage 1806 of theprocessing pipeline 1802 ₈ are unchanged on the output of the secondstage 1806, i.e. A=A′.

However, as described above in the spatial decorrelation, for column E,the first coefficient E′ is given by the equation: E′=E−A mod 2⁸, whichcan be written as =mod₂ ₈ (E−A) to more clearly show the operation ofthe mod function. Since A=A′, we can arrange the equation to give E=mod₂₈ (E′+A′). Therefore, the processing unit 1812 in the processingpipeline 1802 ₇ outputs the spatially decorrelated data values forcolumn E according to this equation using inputs of A′ and E′.

Furthermore, as described above in the spatial decorrelation, for columnG, the first coefficient G′ is given by the equation: G′=mod₂ ₈ (G−E).The equation can be re-arranged to give G=mod₂ ₈ (G′+E). Therefore, theprocessing unit 1812 in the processing pipeline 1802 ₆ outputs thespatially decorrelated data values for column G according to thisequation using inputs of E and G′, wherein the value of E is providedfrom the output of the processing unit 1812 in processing pipeline 1802₇. In other embodiments the calculation of E may be repeated in theprocessing unit 1812 of the processing pipeline 1802 ₆ (as well as inprocessing pipeline 1802 ₇) such that the processing pipeline 1802 ₆does not rely on the output of the processing pipeline 1802 ₇. In theseother embodiments the processing unit 1812 of the processing pipeline1802 ₆ may receive the A and E′ values as inputs as well as the G′value.

Furthermore, as described above in the spatial decorrelation, for columnC, the first coefficient C′ is given by the equation: C′=mod₂ ₈(C−LPredict(A,E)). Using the definition of LPredict given above, theequation can be re-arranged to give:

$C = {{mod}_{2^{8}}\left( {C^{\prime} + \left\lfloor \frac{A + E}{2} \right\rfloor + {\left\{ \begin{matrix}{2^{7},} & {{{if}\mspace{14mu} {{E - A}}} \geq 2^{7}} \\{0,} & {otherwise}\end{matrix} \right).}} \right.}$

Therefore, the processing unit 1812 in the processing pipeline 1802 ₅outputs the spatially decorrelated data values for column C according tothis equation using inputs of A, C′ and E, wherein the value of A isprovided from the output of the first stage 1804 of the processingpipeline 1802 ₈, and the value of E is provided from the output of theprocessing unit 1812 in processing pipeline 1802 ₇. In other embodimentsthe calculation of E may be repeated in the processing unit 1812 of theprocessing pipeline 1802 ₅ (as well as in processing pipeline 1802 ₇)such that the processing pipeline 1802 ₅ does not rely on the output ofthe processing pipeline 1802 ₇, in which case the processing unit 1812of the processing pipeline 1802 ₅ may receive the E′ value as an inputas well as the A and C′ values.

Furthermore, as described above in the spatial decorrelation, for columnB, the first coefficient B′ is given by the equation: B′=mod₂ ₈(B−LPredict(A,C)). The equation can be re-arranged to give:

$B = {{mod}_{2^{8}}\left( {B^{\prime} + \left\lfloor \frac{A + C}{2} \right\rfloor + {\left\{ \begin{matrix}{2^{7},} & {{{if}\mspace{14mu} {{C - A}}} \geq 2^{7}} \\{0,} & {otherwise}\end{matrix} \right).}} \right.}$

Therefore, the processing unit 1812 in the processing pipeline 1802 ₁outputs the spatially decorrelated data values for column B according tothis equation using inputs of A, B′ and C. The value of A is providedfrom the output of the first stage 1804 of the processing pipeline 1802₈, and the value of C is provided from the output of the processing unit1812 in processing pipeline 1802 ₅. In other embodiments the calculationof C may be repeated in the processing unit 1812 of the processingpipeline 1802 ₁ (as well as in processing pipeline 1802 ₅) such that theprocessing pipeline 1802 ₁ does not rely on the output of the processingpipeline 1802 ₅, in which case the processing unit 1812 of theprocessing pipeline 1802 ₁ may receive the C′ and E′ values as inputs aswell as the A and B′ values.

Furthermore, as described above in the spatial decorrelation, for columnD, the first coefficient D′ is given by the equation: D′=mod₂ ₈(D−LPredict(C,E)). The equation can be re-arranged to give:

$D = {{mod}_{2^{8}}\left( {D^{\prime} + \left\lfloor \frac{C + E}{2} \right\rfloor + {\left\{ \begin{matrix}{2^{7},} & {{{if}\mspace{14mu} {{C - E}}} \geq 2^{7}} \\{0,} & {otherwise}\end{matrix} \right).}} \right.}$

Therefore, the processing unit 1812 in the processing pipeline 1802 ₂outputs the spatially decorrelated data values for column D according tothis equation using inputs of C, D′ and E. The value of C is providedfrom the output of the processing unit 1812 in processing pipeline 1802₅, and the value of E is provided from the output of the processing unit1812 in processing pipeline 1802 ₇. In other embodiments the calculationof C may be repeated in the processing unit 1812 of the processingpipeline 1802 ₂ (as well as in processing pipeline 1802 ₅) such that theprocessing pipeline 1802 ₂ does not rely on the output of the processingpipeline 1802 ₅. Furthermore, in these other embodiments, thecalculation of E may be repeated in the processing unit 1812 of theprocessing pipeline 1802 ₂ (as well as in processing pipeline 1802 ₇)such that the processing pipeline 1802 ₂ does not rely on the output ofthe processing pipeline 1802 ₇. In these other embodiments theprocessing unit 1812 of the processing pipeline 1802 ₂ may receive theA, C′ and E′ values as inputs as well as the D′ value.

Furthermore, as described above in the spatial decorrelation, for columnF, the first coefficient F′ is given by the equation: F′=mod₂ ₈(F−LPredict(E,G)). The equation can be re-arranged to give:

$F = {{mod}_{2^{8}}\left( {F^{\prime} + \left\lfloor \frac{E + G}{2} \right\rfloor + {\left\{ \begin{matrix}{2^{7},} & {{{if}\mspace{14mu} {{E - G}}} \geq 2^{7}} \\{0,} & {otherwise}\end{matrix} \right).}} \right.}$

Therefore, the processing unit 1812 in the processing pipeline 1802 ₃outputs the spatially decorrelated data values for column F according tothis equation using inputs of E, F′ and G. The value of E is providedfrom the output of the processing unit 1812 in processing pipeline 1802₇, and the value of G is provided from the output of the processing unit1812 in processing pipeline 1802 ₆. In other embodiments the calculationof E may be repeated in the processing unit 1812 of the processingpipeline 1802 ₃ (as well as in processing pipeline 1802 ₇) such that theprocessing pipeline 1802 ₃ does not rely on the output of the processingpipeline 1802 ₇. Furthermore, in these other embodiments, thecalculation of G may be repeated in the processing unit 1812 of theprocessing pipeline 1802 ₃ (as well as in processing pipeline 1802 ₆)such that the processing pipeline 1802 ₃ does not rely on the output ofthe processing pipeline 1802 ₆. In these other embodiments theprocessing unit 1812 of the processing pipeline 1802 ₃ may receive theA, E′ and G′ values as inputs as well as the F′ value.

Furthermore, as described above in the spatial decorrelation, for columnH, the first coefficient H′ is given by the equation: H′=mod₂ ₈ (H−G).The equation can be re-arranged to give H=mod₂ ₈ (H′+G). Therefore, theprocessing unit 1812 in the processing pipeline 1802 ₄ outputs thespatially decorrelated data values for column H according to thisequation using inputs of G and H′, wherein the value of G is providedfrom the output of the processing unit 1812 in processing pipeline 1802₆. In other embodiments the calculation of G may be repeated in theprocessing unit 1812 of the processing pipeline 1802 ₄ (as well as inprocessing pipeline 1802 ₆) such that the processing pipeline 1802 ₄does not rely on the output of the processing pipeline 1802 ₆. In theseother embodiments the processing unit 1812 of the processing pipeline1802 ₄ may receive the A and E′ values as inputs as well as the H′value.

In this way, the spatial recorrelation module 404 can determine a row ofspatially recorrelated data values on each of a plurality of iterations(e.g. clock cycles). For example, an 8×8 block of data values can bedetermined in eight iterations.

As described above, colour recorrelation is then performed by the colourrecorrelation modules 402 on the data values of the R, G and B channelsoutput from the spatial recorrelation modules 404, to thereby obtain thedecompressed data values.

There have been described above methods and systems for data compressionand decompression wherein a predictable number of data values can becompressed and decompressed on each of a plurality of consecutive clockcycles. In the examples described in detail above, the data values haveARGB 8:8:8:8 format (such that there are four colour channels, eachhaving eight-bit data values) and the blocks of data are 8×8 blocks ofdata. In other examples, other colour formats may be used (e.g. ARGB2:10:10:10, in which the Alpha channel data values have 2 bits and theRed, Green and Blue channel data values have 10 bits) and/or other sizesof data blocks may be used (e.g. 4×16, 2×32, 16×16, etc.). A personskilled in the art would be able to apply the principles described aboveto other colour formats and/or other sizes of data blocks.

Furthermore, the above description of the “rows” and “columns” of thedata block is not limiting in the sense that in other examples thecolumns of data blocks could be processed as the rows are processed inthe examples described above, and the rows of data blocks could beprocessed as the columns are processed in the examples described above.

Generally, any of the functions, methods, techniques or componentsdescribed above can be implemented in modules using software, firmware,hardware (e.g., fixed logic circuitry), or any combination of theseimplementations. The terms “module,” “functionality,” “component”,“block”, “unit” and “logic” may be used herein to generally representsoftware, firmware, hardware, or any combination thereof.

In the case of a software implementation, the module, functionality,component or logic represents program code that performs specified taskswhen executed on a processor (e.g. one or more CPUs). In one example,the methods described may be performed by a computer configured withsoftware in machine readable form stored on a computer-readable medium.One such configuration of a computer-readable medium is signal bearingmedium and thus is configured to transmit the instructions (e.g. as acarrier wave) to the computing device, such as via a network. Thecomputer-readable medium may also be configured as a computer-readablestorage medium and thus is not a signal bearing medium. Examples of acomputer-readable storage medium include a random-access memory (RAM),read-only memory (ROM), an optical disc, flash memory, hard disk memory,and other memory devices that may use magnetic, optical, and othertechniques to store instructions or other data and that can be accessedby a machine.

The software may be in the form of a computer program comprisingcomputer program code for configuring a computer to perform theconstituent portions of described methods or in the form of a computerprogram comprising computer program code means adapted to perform allthe steps of any of the methods described herein when the program is runon a computer and where the computer program may be embodied on acomputer readable medium. The program code can be stored in one or morecomputer readable media. The features of the techniques described hereinare platform-independent, meaning that the techniques may be implementedon a variety of computing platforms having a variety of processors.

Those skilled in the art will also realize that all, or a portion of thefunctionality, techniques or methods may be carried out by a dedicatedcircuit, an application-specific integrated circuit, a programmablelogic array, a field-programmable gate array, or the like. For example,the module, functionality, component or logic may comprise hardware inthe form of circuitry. Such circuitry may include transistors and/orother hardware elements available in a manufacturing process. Suchtransistors and/or other elements may be used to form circuitry orstructures that implement and/or contain memory, such as registers, flipflops, or latches, logical operators, such as Boolean operations,mathematical operators, such as adders, multipliers, or shifters, andinterconnects, by way of example. Such elements may be provided ascustom circuits or standard cell libraries, macros, or at other levelsof abstraction. Such elements may be interconnected in a specificarrangement. The module, functionality, component or logic may includecircuitry that is fixed function and circuitry that can be programmed toperform a function or functions; such programming may be provided from afirmware or software update or control mechanism. In an example,hardware logic has circuitry that implements a fixed function operation,state machine or process.

It is also intended to encompass software which “describes” or definesthe configuration of hardware that implements a module, functionality,component or logic described above, such as HDL (hardware descriptionlanguage) software, as is used for designing integrated circuits, or forconfiguring programmable chips, to carry out desired functions. That is,there may be provided a computer readable storage medium having encodedthereon computer readable program code for generating a processing unitconfigured to perform any of the methods described herein, or forgenerating a processing unit comprising any apparatus described herein.That is, a computer system may be configured to generate arepresentation of a digital circuit from definitions of circuit elementsand data defining rules for combining those circuit elements, wherein anon-transitory computer readable storage medium may have stored thereonprocessor executable instructions that when executed at such a computersystem, cause the computer system to generate spatialdecorrelation/recorrelation modules as described herein. To put itanother way, there may be provided a non-transitory computer readablestorage medium having stored thereon computer readable instructionsthat, when processed at a computer system for generating a manifestationof an integrated circuit, cause the computer system to generate amanifestation of a spatial decorrelation module or a spatialrecorrelation module according to any of the examples described herein.

The term ‘processor’ and ‘computer’ are used herein to refer to anydevice, or portion thereof, with processing capability such that it canexecute instructions, or a dedicated circuit capable of carrying out allor a portion of the functionality or methods, or any combinationthereof.

Although the subject matter has been described in language specific tostructural features and/or methodological acts, it is to be understoodthat the subject matter defined in the appended claims is notnecessarily limited to the specific features or acts described above.Rather, the specific features and acts described above are disclosed asexample forms of implementing the claims. It will be understood that thebenefits and advantages described above may relate to one example or mayrelate to several examples.

Any range or value given herein may be extended or altered withoutlosing the effect sought, as will be apparent to the skilled person. Thesteps of the methods described herein may be carried out in any suitableorder, or simultaneously where appropriate. Aspects of any of theexamples described above may be combined with aspects of any of theother examples described to form further examples without losing theeffect sought.

What is claimed is:
 1. A method of performing spatial decorrelation on ablock of data values at a processing module as part of a datacompression process, wherein the processing module comprises a pluralityof processing pipelines each comprising a first stage and a secondstage, the method comprising, iteratively: processing a line of datavalues at the first stages of the processing pipelines, and outputtingfirst coefficients resulting from the processing to the second stages ofthe processing pipelines; and implementing, at the second stages of theprocessing pipelines, spatial decorrelation on one or more firstcoefficients, and outputting spatially decorrelated data values;wherein, in each of a plurality of iterations, a respective line of datavalues is received at the first stages of the processing pipelines,wherein the lines are received over the plurality of iterations in aparticular order such that if the first coefficients for a particularline will be used for the spatial decorrelation for another line thenthe data values of the particular line are received at the first stagesin an earlier iteration to that in which the data values of said anotherline are received at the first stages.
 2. The method of claim 1, furthercomprising storing the first coefficients for a first line of datavalues at the second stages of the processing pipelines if the firstcoefficients for the first line will be used for the spatialdecorrelation for a second line of the block on a subsequent iteration.3. The method of claim 1, wherein said processing a line of data valuesat the first stages of the processing pipelines comprises implementingspatial decorrelation on one or more data values from the line.
 4. Themethod of claim 1, wherein the method operations are iterated fordifferent lines of the data values of the block until spatiallydecorrelated data values are output from the second stages of theprocessing pipelines for data values of all of the lines of data valuesin the block.
 5. A data compression unit comprising a processing moduleconfigured to perform spatial decorrelation on a block of data values,wherein the processing module comprises: a plurality of processingpipelines each having a first stage and a second stage; wherein thefirst stages of the processing pipelines are configured to process aline of data values and output first coefficients resulting from theprocessing to the second stages of the processing pipelines; and whereinthe second stages of the processing pipelines are configured to:selectively store the first coefficients for the line of data values,implement spatial decorrelation on one or more first coefficients, andoutput spatially decorrelated data values for the line of data values;wherein the second stages of the processing pipelines are configured tostore the first coefficients for the line of data values if the firstcoefficients for the line will be used for the spatial decorrelation foranother line of the block.
 6. The data compression unit of claim 5,wherein the first stages of the processing pipelines are configured toreceive, over a plurality of iterations, respective lines of data valuesin a particular order such that if the first coefficients for aparticular line will be used for the spatial decorrelation for anotherline then the data values of the particular line are received at thefirst stages in an earlier iteration to that in which the data values ofsaid another line are received at the first stages.
 7. The datacompression unit of claim 5, further comprising a colour decorrelationmodule which is configured to apply colour decorrelation to blocks ofdata, wherein the data compression unit is arranged such that blocks ofdata output from the colour decorrelation module are received at theprocessing module in order for spatial decorrelation to be appliedthereto.
 8. The data compression unit of claim 5, further comprising anentropy encoding module which is configured to apply entropy encoding tothe spatially decorrelated data values outputted from the processingmodule.
 9. A method of performing spatial recorrelation on a block ofspatially decorrelated data values at a processing module as part of adata decompression process, wherein the processing module comprises aplurality of processing pipelines each comprising a first stage and asecond stage, the method comprising, iteratively: implementing, at thefirst stages of the processing pipelines, spatial recorrelation on aline of spatially decorrelated data values, and outputting firstcoefficients resulting from the spatial recorrelation to the secondstages of the processing pipelines; and processing the firstcoefficients at the second stages of the processing pipelines, andoutputting spatially recorrelated data values; wherein in each of aplurality of iterations, a respective line of spatially decorrelateddata values is received at the first stages of the processing pipelines,wherein the lines are received over the plurality of iterations in aparticular order such that if the first coefficients for a particularline will be used for the spatial recorrelation for another line thenthe spatially decorrelated data values of the particular line arereceived at the first stages in an earlier iteration to that in whichthe spatially decorrelated data values of said another line are receivedat the first stages.
 10. The method of claim 9, wherein the first stagesof the processing pipelines are configured to store the firstcoefficients for a first line of spatially decorrelated data values ifthe first coefficients for the first line will be used for the spatialrecorrelation for a second line of the block on a subsequent iteration.11. The method of claim 9, wherein said processing the firstcoefficients at the second stages of the processing pipelines comprisesimplementing spatial recorrelation on one or more first coefficients fora line.
 12. The method of claim 9, wherein the method operations areiterated for different lines of spatially decorrelated data values ofthe block until spatially recorrelated data values are output from thesecond stages of the processing pipelines for spatially decorrelateddata values of all of the lines of spatially decorrelated data values inthe block.
 13. The method of claim 9, wherein the plurality ofiterations correspond with a plurality of consecutive clock cycles. 14.The method of claim 9, wherein the number of processing pipelines in theprocessing module equals the number of spatially decorrelated datavalues in each line of the block.
 15. A data decompression unitcomprising a processing module configured to perform spatialrecorrelation on a block of spatially decorrelated data values, whereinthe processing module comprises: a plurality of processing pipelineseach comprising a first stage and a second stage; wherein the firststages of the processing pipelines are configured to: implement spatialrecorrelation on a line of spatially decorrelated data values, andoutput first coefficients resulting from the spatial recorrelation tothe second stages of the processing pipelines, and selectively store thefirst coefficients for the line of spatially decorrelated data values;wherein the second stages of the processing pipelines are configured toprocess the first coefficients and output spatially recorrelated datavalues; and wherein the first stages of the processing pipelines areconfigured to store the first coefficients for the line of spatiallydecorrelated data values if the first coefficients for the line will beused for the spatial recorrelation for another line of the block. 16.The data decompression unit of claim 15, wherein the first stages of theprocessing pipelines are configured to receive, over a plurality ofiterations, respective lines of spatially decorrelated data values in aparticular order such that if the first coefficients for a particularline will be used for the spatial recorrelation for another line thenthe spatially decorrelated data values of the particular line arereceived at the first stages in an earlier iteration to that in whichthe spatially decorrelated data values of said another line are receivedat the first stages.
 17. The data decompression unit of claim 15,wherein the spatially decorrelated data values in the block are arrangedinto a two dimensional array which has m rows and n columns, where m>1and n>1, and wherein the processing module comprises n parallelprocessing pipelines.
 18. The data decompression unit of claim 15,further comprising a colour recorrelation module which is configured toapply colour recorrelation to blocks of data, wherein the datadecompression unit is arranged such that the spatially recorrelatedblocks of data output from the processing module are received at thecolour recorrelation module in order for colour recorrelation to beapplied thereto.
 19. The data decompression unit of claim 15, furthercomprising an entropy decoding module which is configured to applyentropy decoding to entropy encoded data values wherein the output ofthe entropy decoding module provides the spatially decorrelated datavalues as the input to the processing module.